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

klsxnrf1  于 2023-08-04  发布在  其他
关注(0)|答案(1)|浏览(146)

我尝试使用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: eslint-config-next@12.0.4
[14:58:04.077] npm ERR! Found: eslint@8.44.0
[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/eslint-utils@4.4.0
[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 eslint@8.44.0
[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 eslint-config-next@12.0.4
[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: eslint@7.32.0
[14:58:04.078] npm ERR! node_modules/eslint
[14:58:04.078] npm ERR!   peer eslint@"^7.23.0" from eslint-config-next@12.0.4
[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再次安装next lint,但没有什么区别。

ef1yzkbh

ef1yzkbh1#

1.转到Vercel上的项目设置
1.在左侧菜单中选择“常规”,然后滚动到“构建和开发设置”
1.打开“安装命令”的“覆盖”
1.在输入中写入npm install --legacy-peer-deps

相关问题