Search code examples
npmnext.jsdeploymentvercellint

How can I fix this dependancy error when deploying a nextjs 13 app with vercel?


I am trying to deploy my NextJS 13 app with vercel, but I get this error on deploying. In vscode, I have ran the linting and it returned no problems. Also did 'npm run build' in vscode which worked fine.

...
[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

I have tried installing next lint again with npm but that has made no difference.


Solution

    1. Go to your project's settings on vercel
    2. Choose "General" on left menu and scroll to "Build & Development Settings"
    3. Turn the "override" on for "install command"
    4. Write npm install --legacy-peer-deps in the input.