vuejs / eslint-config-standard

ESLint Shareable Configs for JavaScript Standard Style in Vue.js Projects
MIT License
41 stars 14 forks source link

Peer dependency conflict when creating projects using NPM 8 #24

Open OliverRC opened 2 years ago

OliverRC commented 2 years ago

In reference to the following issue: https://github.com/vuejs/vue-cli/issues/7189

It looks like this library at the default install of version 6.1.0 when using the Vue CLI has incompatible peer dependencies with the eslint-plugin-vue module installed as part of the Vue CLI setup.

This is broken out the box on Vue CLI version 5.x on NPM 8

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.5.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.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.

Step to Reproduce

Vue CLI v5.0.8
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Linter
? Choose a version of Vue.js that you want to start the project with 3.x
? Pick a linter / formatter config: Standard
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? (y/N)
frederikheld commented 2 years ago

Same here. Tried to submit the issue to eslint-plugin-vue but they closed it.

--> https://github.com/vuejs/eslint-plugin-vue/issues/1931

OliverRC commented 2 years ago

How frustrating that they just closed your PR with no discussion and then locked the thread @frederikheld. Is anyone going to take accountability for the fact that ESLint on Vue is broken on NPM 8.

@ota-meshi how can you just close the PR with no explanation and no resolution to a legitimate issue. @vuejs

ES Lint does not work out of the box with Vue CLI.

OliverRC commented 2 years ago

Actually I was able to reproduce this. It seems the offending configuration is the use of the option that uses the Standard configuration for the linter

vue create hello-world

Choose the following options:

Vue CLI v5.0.8
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Linter
? Choose a version of Vue.js that you want to start the project with 3.x
? Pick a linter / formatter config: Standard  <--------- This is what is causing the issue
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? No

Delete the node_modules folder

npm install

Breaks with the following error=

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.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 C:\Users\<user>\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<user>\AppData\Local\npm-cache\_logs\2022-10-04T07_28_32_337Z-debug-0.log
lalainarahajason commented 2 years ago

Exactly same error here, any solutions ?

lalainarahajason commented 2 years ago

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @vue/eslint-config-standard@6.1.0

after steps above too

OliverRC commented 1 year ago

We've abandoned Vue-CLI in favour for Vite

Hoon-Hub commented 1 year ago

"eslint-plugin-vue": "^7.20.0", I've changed "eslint-plugin-vue" to 7.20.0 and npm i -> audit fix. after this work, command npm i worked well. 캡처