Factsheet
» npm install typescript-eslint
Why can't I do npm install after setting up eslint with TypeScript?
reactjs - npm WARN @typescript-eslint/eslint-plugin@1.6.0 requires a peer of typescript@* - Stack Overflow
Error while installing @typescript-eslint/eslint-plugin - Stack Overflow
typescript - how to fix these npm install errors - Stack Overflow
» npm install eslint
I can't figure this out. Running eslint works but I can't do npm install anymore. I just followed the official docs for setup.
This is the error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: typescript-eslint@7.16.1
npm ERR! Found: eslint@9.7.0
npm ERR! node_modules/eslint
npm ERR! dev eslint@"^9.7.0" from the root project
npm ERR! peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from u/eslint-community/eslint-utils@4.4.0
npm ERR! node_modules/@eslint-community/eslint-utils
npm ERR! u/eslint-community/eslint-utils@"^4.2.0" from eslint@9.7.0
npm ERR! u/eslint-community/eslint-utils@"^4.4.0" from u/typescript-eslint/utils@7.16.1
npm ERR! node_modules/typescript-eslint/node_modules/@typescript-eslint/utils
npm ERR! u/typescript-eslint/utils@"7.16.1" from typescript-eslint@7.16.1
npm ERR! node_modules/typescript-eslint
npm ERR! dev typescript-eslint@"^7.16.1" from the root project
npm ERR! 2 more (@typescript-eslint/eslint-plugin, u/typescript-eslint/type-utils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.56.0" from typescript-eslint@7.16.1
npm ERR! node_modules/typescript-eslint
npm ERR! dev typescript-eslint@"^7.16.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint@8.57.0
npm ERR! node_modules/eslint
npm ERR! peer eslint@"^8.56.0" from typescript-eslint@7.16.1
npm ERR! node_modules/typescript-eslint
npm ERR! dev typescript-eslint@"^7.16.1" 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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/user/.npm/_logs/2024-07-19T18_04_24_783Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /Users/user/.npm/_logs/2024-07-19T18_04_24_783Z-debug-0.log
try this:
- Delete 'package-lock.json' file
- In the Terminal go to the folder with your project and type 'npm install --save typescript'
- Then type 'npm install'
It helped me.
You can also resolve this issue by just installing typescript (it's clearly written in the debug output)
$ npm install typescript
You may also use other package-managers in favor of npm like pnpm or yarn.
Update: You can also use an npm package that does this for you. Helpful when there are many peer dependencies.
The package is npm-install-peers. If you want slightly more control over these, you may want to check out install-peerdeps
Also, please do a further read on this StackOverflow answer.
» npm install eslint-import-resolver-typescript