You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observe the build failure with the EBADF spawn error after "Collecting page data" step
Note that the issue is more severe in my private project which contains more files and greater complexity.
Current vs. Expected behavior
Expected Behavior
Next.js should successfully build the project regardless of the number of files and folders in the pages directory, with appropriate resource management.
Actual Behavior
The build process fails after successfully completing the "Collecting page data" step:
✓ Linting and checking validity of types
Creating an optimized production build ...
✓ Compiled successfully in 14.0s
✓ Collecting page data
> Build error occurred
[Error: spawn EBADF] { errno: -9, code: 'EBADF', syscall: 'spawn' }
This indicates the build process completes compilation and page data collection successfully, but fails when attempting to proceed to the next step.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: 1.22.21
pnpm: N/A
Relevant Packages:
next: 15.3.1-canary.11 // Latest available version is detected (15.3.1-canary.11).
eslint-config-next: 15.3.0
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Output
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
System Information
Next.js version: ^15.3.1-canary.11
Operating System: macOS (MacBook Pro M2)
Node.js version: v22.14.0
Package Manager and version: npm 10.9.2
Additional Information
The timing of the error (after successfully collecting page data) suggests that the issue may occur during the optimization or bundling phase, when Next.js attempts to process all the collected pages simultaneously.
This appears to be a regression issue. I've tested the following versions:
Next.js 15.3.0: Error still occurs
Next.js 14.2.28: Builds successfully with the same number of files
The problem seems to have been introduced in version 15.x of Next.js, as version 14.2.28 handles the same project structure without errors.
The text was updated successfully, but these errors were encountered:
I had the same problem when building, how could I fix it?
@wuguoguang There’s no proper solution yet. For now, I just downgraded to version 14.2.28 and it works fine. I’ll stick with it until there’s a fix or a better solution comes along.
I hope nextjs team takes this issue with greater urgency. We have the same exact issue as reported. It happens since first 15.0 version. We have 150 pages in our project and this same issue happens. If I delete half the pages, it builds without issue. The app is working great otherwise, just can't build it.
Link to the code that reproduces this issue
https://github.com/Sarawut-keng/nextjs-build-error-reproduction
To Reproduce
next build
Note that the issue is more severe in my private project which contains more files and greater complexity.
Current vs. Expected behavior
Expected Behavior
Next.js should successfully build the project regardless of the number of files and folders in the pages directory, with appropriate resource management.
Actual Behavior
The build process fails after successfully completing the "Collecting page data" step:
This indicates the build process completes compilation and page data collection successfully, but fails when attempting to proceed to the next step.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 22.14.0 npm: 10.9.2 Yarn: 1.22.21 pnpm: N/A Relevant Packages: next: 15.3.1-canary.11 // Latest available version is detected (15.3.1-canary.11). eslint-config-next: 15.3.0 react: 19.1.0 react-dom: 19.1.0 typescript: 5.8.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Output
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
System Information
Additional Information
The timing of the error (after successfully collecting page data) suggests that the issue may occur during the optimization or bundling phase, when Next.js attempts to process all the collected pages simultaneously.
This appears to be a regression issue. I've tested the following versions:
The problem seems to have been introduced in version 15.x of Next.js, as version 14.2.28 handles the same project structure without errors.
The text was updated successfully, but these errors were encountered: