簡體   English   中英

錯誤:命令“npm run build”以 1 退出。vercel 部署錯誤與 next.js

[英]Error: Command "npm run build" exited with 1. vercel deploy error with next.js

我正在嘗試使用 vercel 和我的 git 存儲庫部署我的 next.js 網站。 這是我從 vercel 部署網站控制台收到的消息。 嘗試安裝 emoition/react 仍然無法正常工作。

   14:59:59.757     Cloning github.com/dor29494/my-app (Branch: test, Commit: 400d8a4)
15:00:00.829    Cloning completed: 1.072s
15:00:00.851    Analyzing source code...
15:00:01.658    Installing build runtime...
15:00:04.373    Build runtime installed: 2.715s
15:00:06.725    Build cache not provided
15:00:07.847    Installing dependencies...
15:00:08.325    npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
15:00:19.992    > core-js@3.6.5 postinstall /vercel/path0/node_modules/core-js
15:00:19.992    > node -e "try{require('./postinstall')}catch(e){}"
15:00:20.088    > protobufjs@6.10.2 postinstall /vercel/path0/node_modules/protobufjs
15:00:20.088    > node scripts/postinstall
15:00:20.443    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
15:00:20.443    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
15:00:20.445    added 539 packages from 364 contributors in 12.152s
15:00:20.626    31 packages are looking for funding
15:00:20.626      run `npm fund` for details
15:00:20.648    Detected Next.js version: 10.0.8
15:00:20.649    Running "npm run build"
15:00:20.861    > learn-starter@0.1.0 build /vercel/path0
15:00:20.861    > next build
15:00:21.906    info  - Creating an optimized production build...
15:00:21.922    Attention: Next.js now collects completely anonymous telemetry regarding usage.
15:00:21.922    This information is used to shape Next.js' roadmap and prioritize features.
15:00:21.922    You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
15:00:21.922    https://nextjs.org/telemetry
15:00:26.563    Failed to compile.
15:00:26.563    ModuleNotFoundError: Module not found: Error: Can't resolve '@emotion/styled' in '/vercel/path0/node_modules/@material-ui/core/node_modules/@material-ui/styled-engine'
15:00:26.563    > Build error occurred
15:00:26.564    Error: > Build failed because of webpack errors
15:00:26.564        at /vercel/path0/node_modules/next/dist/build/index.js:15:918
15:00:26.564        at runMicrotasks (<anonymous>)
15:00:26.564        at processTicksAndRejections (internal/process/task_queues.js:93:5)
15:00:26.564        at async /vercel/path0/node_modules/next/dist/build/tracer.js:3:470
15:00:26.578    npm ERR! code ELIFECYCLE
15:00:26.578    npm ERR! errno 1
15:00:26.581    npm ERR! learn-starter@0.1.0 build: `next build`
15:00:26.581    npm ERR! Exit status 1
15:00:26.581    npm ERR! 
15:00:26.581    npm ERR! Failed at the learn-starter@0.1.0 build script.
15:00:26.581    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
15:00:26.589    npm ERR! A complete log of this run can be found in:
15:00:26.589    npm ERR!     /vercel/.npm/_logs/2021-05-19T12_00_26_582Z-debug.log
15:00:26.601    Error: Command "npm run build" exited with 1

Error: Command “npm run build” exited with 1不是 Vercel 顯示的實際錯誤。

實際錯誤以紅色顯示在日志中。

錯誤日志示例vercel 錯誤日志

在您的日志中,您可以看到導致構建過程失敗Can't resolve '@emotion/styled'錯誤。

你必須先修復它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM