vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.04k stars 27k forks source link

New project npx next build error #72878

Open RobertKoval opened 13 hours ago

RobertKoval commented 13 hours ago

Link to the code that reproduces this issue

https://github.com/RobertKoval/issue_nextjs

To Reproduce

1) Create a new project using npx create-next-app@latest 2) run npx next build

Current vs. Expected behavior

I expected the project to compile, but instead, I encountered an error:

(node:9416) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
   ▲ Next.js 15.0.3

   Creating an optimized production build ...
Failed to compile.

./app/page.tsx + 1 modules
Unexpected end of JSON input

> Build failed because of webpack errors

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 23.2.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 9.4.0
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: 15.0.3
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

create-next-app, Developer Experience, Webpack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

RobertKoval commented 8 hours ago

I tried with different NodeJS versions, v21.7.3 and v22.11.0 works fine.

JulioBarros commented 6 hours ago

I have this same issue with a brand new project with no edits just npx create-next-app@latest buildtest and then npm run build fails with

❯ npm run build

> buildtest@0.1.0 build
> next build

   ▲ Next.js 15.0.3

   Creating an optimized production build ...
Failed to compile.

./src/app/page.tsx + 1 modules
Unexpected end of JSON input

> Build failed because of webpack errors

I'm on node version v23.2.0