莫名环境坏掉了……

BeijingBaby · 2024-11-15 16:29:38 · 104 次点击

可能升级了什么系统的依赖,最简单的项目都跑不起来了郁闷,看日志也找不出问题。

刚开始还以为项目中更改了什么导致的

尝试创建新项目:

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@fshex3.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 fshex3.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
举报· 104 次点击
登录 注册 站外分享
快来抢沙发
0 条回复  
返回顶部