wesbos / eslint-config-wesbos

No-Sweat™ Eslint and Prettier Setup - with or without VS Code
2.74k stars 419 forks source link

Next.js 12.0.7 - could not resolve dependencies #102

Closed shimamooo closed 2 years ago

shimamooo commented 2 years ago

Trying to run

npm install eslint-config-wesbos@2.1.0 @babel/core@^7.15.8 @types/node@^16.7.13 @typescript-eslint/eslint-plugin@^4.31.0 @typescript-eslint/parser@^4.31.0 eslint@^7.32.0 eslint-config-airbnb@^18.2.1 eslint-config-airbnb-typescript@^14.0.0 eslint-config-prettier@^8.3.0 eslint-plugin-html@^6.1.2 eslint-plugin-import@^2.24.2 eslint-plugin-jsx-a11y@^6.4.1 eslint-plugin-prettier@^4.0.0 eslint-plugin-react@^7.25.1 eslint-plugin-react-hooks@^4.2.0 prettier@^2.3.2 typescript@^4.4.2 @babel/eslint-parser@^7.15.4 @babel/preset-react@^7.14.5 --save-dev

fails on most recent version of Next.js 12.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: starter@undefined
npm ERR! Found: @typescript-eslint/parser@5.6.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   @typescript-eslint/parser@"^5.0.0" from eslint-config-next@12.0.7
npm ERR!   node_modules/eslint-config-next
npm ERR!     dev eslint-config-next@"12.0.7" from the root project
npm ERR!   dev @typescript-eslint/parser@"^4.31.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @typescript-eslint/eslint-plugin@"^4.31.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @typescript-eslint/parser@4.33.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^4.0.0" from @typescript-eslint/eslint-plugin@4.33.0
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"^4.31.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Error message indicates @typescript-eslint/parser@^4.31.0 conflicts with eslint-config-next, which has a peer dependency of eslint@"^5.0.0 || ^6.0.0 || ^7.0.0".

I really love using this config! Maybe it's time for a small dependency bump?

Asjas commented 2 years ago

You need to re-run the command with --force or --legacy-peer-deps as suggested by the npm error and it will work 😃 @AnthonyKuang

wesbos commented 2 years ago

I also just released v3 of my config which uses the latest everything.

shimamooo commented 2 years ago

Woohooo, thanks all! Found out that next@12.0.5 contained some package bumps and changes to eslint-config-next. v3 works great now 🎉