使用 vercel 部署 nextjs 13 应用程序时如何修复此依赖性错误?

问题描述 投票:0回答:0

我正在尝试使用 vercel 部署我的 NextJS 13 应用程序,但在部署时出现此错误。在 vscode 中,我运行了 linting,它没有返回任何问题。在 vscode 中也做了“npm run build”,效果很好。

...
[14:58:01.978] Previous build cache not available
[14:58:02.279] Cloning completed: 593.19ms
[14:58:02.615] Running "vercel build"
[14:58:03.127] Vercel CLI 31.1.1
[14:58:03.363] Installing dependencies...
[14:58:04.074] npm ERR! code ERESOLVE
[14:58:04.077] npm ERR! ERESOLVE could not resolve
[14:58:04.077] npm ERR! 
[14:58:04.077] npm ERR! While resolving: [email protected]
[14:58:04.077] npm ERR! Found: [email protected]
[14:58:04.077] npm ERR! node_modules/eslint
[14:58:04.077] npm ERR!   eslint@"8.44.0" from the root project
[14:58:04.078] npm ERR!   peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/[email protected]
[14:58:04.078] npm ERR!   node_modules/@eslint-community/eslint-utils
[14:58:04.078] npm ERR!     @eslint-community/eslint-utils@"^4.2.0" from [email protected]
[14:58:04.078] npm ERR!   5 more (eslint-import-resolver-typescript, ...)
[14:58:04.078] npm ERR! 
[14:58:04.078] npm ERR! Could not resolve dependency:
[14:58:04.078] npm ERR! peer eslint@"^7.23.0" from [email protected]
[14:58:04.078] npm ERR! node_modules/eslint-config-next
[14:58:04.078] npm ERR!   eslint-config-next@"^12.0.4" from the root project
[14:58:04.078] npm ERR! 
[14:58:04.078] npm ERR! Conflicting peer dependency: [email protected]
[14:58:04.078] npm ERR! node_modules/eslint
[14:58:04.078] npm ERR!   peer eslint@"^7.23.0" from [email protected]
[14:58:04.078] npm ERR!   node_modules/eslint-config-next
[14:58:04.078] npm ERR!     eslint-config-next@"^12.0.4" from the root project
[14:58:04.079] npm ERR! 
[14:58:04.079] npm ERR! Fix the upstream dependency conflict, or retry
[14:58:04.079] npm ERR! this command with --force or --legacy-peer-deps
[14:58:04.079] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
[14:58:04.079] npm ERR! 
[14:58:04.079] npm ERR! 
[14:58:04.080] npm ERR! For a full report see:
[14:58:04.080] npm ERR! /vercel/.npm/_logs/2023-07-31T13_58_03_754Z-eresolve-report.txt
[14:58:04.080] 
[14:58:04.080] npm ERR! A complete log of this run can be found in:
[14:58:04.080] npm ERR!     /vercel/.npm/_logs/2023-07-31T13_58_03_754Z-debug-0.log
[14:58:04.093] Error: Command "npm install" exited with 1

我尝试使用 npm 再次安装下一个 lint,但这没有什么区别。

npm next.js deployment vercel lint
© www.soinside.com 2019 - 2024. All rights reserved.