可能升级了什么系统的依赖,最简单的项目都跑不起来了郁闷,看日志也找不出问题。
刚开始还以为项目中更改了什么导致的
尝试创建新项目:
npx create-next-app@latest
之后执行 build
npm run build --verbose
~/D/t/my-app on main npm run build --verbose 16:25:45
npm verbose cli /opt/homebrew/Cellar/node/23.2.0/bin/node /opt/homebrew/bin/npm
npm info using npm@10.9.0
npm info using node@v23.2.0
npm verbose title npm run build
npm verbose argv "run" "build" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/Users/xxx/.npm/_logs/2024-11-15T08_25_54_292Z-
npm verbose logfile /Users/xxx/.npm/_logs/2024-11-15T08_25_54_292Z-debug-0.log
> my-app@0.1.0 build
> next build
▲ Next.js 15.0.3
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
Collecting page data ..Error: Failed to collect configuration for /
at <unknown> (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1131:23)
at async Span.traceAsyncFn (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20) {
[cause]: TypeError: e[o] is not a function
at Function.t (/Users/xxx/Downloads/tt2/my-app/.next/server/webpack-runtime.js:1:127)
at async getLayoutOrPageModule (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/server/lib/app-dir-module.js:37:15)
at async collectAppPageSegments (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/build/segment-config/app/app-segments.js:50:45)
at async (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1129:28)
at async Span.traceAsyncFn (/Users/xxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20)
}
> Build error occurred
Error: Failed to collect page data for /
at <unknown> (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1234:15) {
type: 'Error'
}
npm verbose cwd /Users/xxx/Downloads/tt2/my-app
npm verbose os Darwin 22.6.0
npm verbose node v23.2.0
npm verbose npm v10.9.0
npm verbose exit 1
npm verbose code 1
用不同的 node 版本也试过了依旧如此,有遇到类似的吗?
有时候是出现这个:全新项目什么都不改。
npm run build 16:32:55
> my-app@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
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.