eslint --init won't work with npm >=7
See original GitHub issueTell us about your environment
- ESLint Version: 7.23.0
- Node Version: 12.21.0
- npm Version: 7.8.0
- Operating System: Ubuntu 20.04
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using? @typescript-eslint/parser
Please show your full configuration:
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ Which style guide do you want to follow? · standard
✔ What format do you want your config file to be in? · JavaScript
Checking peerDependencies of eslint-config-standard@latest
The config that you've selected requires the following dependencies:
eslint-plugin-react@latest @typescript-eslint/eslint-plugin@latest eslint-config-standard@latest eslint@^7.12.1 eslint-plugin-import@^2.22.1 eslint-plugin-node@^11.1.0 eslint-plugin-promise@^4.2.1 @typescript-eslint/parser@latest
✔ Would you like to install them now with npm? · No / Yes
Installing eslint-plugin-react@latest, @typescript-eslint/eslint-plugin@latest, eslint-config-standard@latest, eslint@^7.12.1, eslint-plugin-import@^2.22.1, eslint-plugin-node@^11.1.0, eslint-plugin-promise@^4.2.1, @typescript-eslint/parser@latest
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
yarn add -D eslint@latest
npx eslint --init
npx eslint --init
What did you expect to happen?
Install eslint with required dependencies
What actually happened? Please copy-paste the actual, raw output from ESLint.
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ Which style guide do you want to follow? · standard
✔ What format do you want your config file to be in? · JavaScript
Checking peerDependencies of eslint-config-standard@latest
The config that you've selected requires the following dependencies:
eslint-plugin-react@latest @typescript-eslint/eslint-plugin@latest eslint-config-standard@latest eslint@^7.12.1 eslint-plugin-import@^2.22.1 eslint-plugin-node@^11.1.0 eslint-plugin-promise@^4.2.1 @typescript-eslint/parser@latest
✔ Would you like to install them now with npm? · No / Yes
Installing eslint-plugin-react@latest, @typescript-eslint/eslint-plugin@latest, eslint-config-standard@latest, eslint@^7.12.1, eslint-plugin-import@^2.22.1, eslint-plugin-node@^11.1.0, eslint-plugin-promise@^4.2.1, @typescript-eslint/parser@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @typescript-eslint/eslint-plugin@3.10.1
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR! @typescript-eslint/eslint-plugin@"^3.1.0" from @react-native-community/eslint-config@2.0.0
npm ERR! node_modules/@react-native-community/eslint-config
npm ERR! dev @react-native-community/eslint-config@"^2.0.0" from the root project
npm ERR! dev @typescript-eslint/eslint-plugin@"4.20.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @typescript-eslint/eslint-plugin@"4.20.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @typescript-eslint/parser@4.20.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR! peer @typescript-eslint/parser@"^4.0.0" from @typescript-eslint/eslint-plugin@4.20.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR! dev @typescript-eslint/eslint-plugin@"4.20.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.
npm ERR!
npm ERR! See /home/fbillioud/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fbillioud/.npm/_logs/2021-04-02T11_51_18_888Z-debug.log
Oops! Something went wrong! :(
Steps to reproduce this issue:
- install npm >= 7
- create a new project
- run
eslint --init
Are you willing to submit a pull request to fix this bug?
I’m not sure about where the related code is, but if someone indicates this to me, we could probably switch npm to yarn which appears to be way more reliable in many aspects. Otherwise, we could test the version of npm being used, and add --legacy-peer-deps
if needed.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
Yeah, this seems like a bug. We probably need to do something about peer dependencies at this stage of the process.
Even with npm 7, it’s better to explicitly install peer deps so they show up in package.json.