peer dependency confilct when creating projects using vue 2 on npm
Version
4.5.15
Reproduction link
Environment info
Windows, new laptop & installation
Steps to reproduce
Run
vue create project_name
to create a vue project and then choose vue 2. Then
cd project_name && npm update
What is expected?
Dependencies updated
What is actually happening?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR! peer eslint@">= 4.12.1" from [email protected]
npm ERR! node_modules/babel-eslint
npm ERR! dev babel-eslint@"^10.1.0" from the root project
npm ERR! peer eslint@">=5.0.0" from [email protected]
npm ERR! node_modules/vue-eslint-parser
npm ERR! vue-eslint-parser@"^7.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR! dev eslint-plugin-vue@"^6.2.2" from the root project
npm ERR! 1 more (the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-plugin-eslint
npm ERR! dev @vue/cli-plugin-eslint@"^4.5.15" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-plugin-eslint
npm ERR! dev @vue/cli-plugin-eslint@"^4.5.15" 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\greg\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!
Opening because https://github.com/vuejs/vue-cli/issues/6270 is closed and I can't re-open it.
Workaround is from: https://github.com/vuejs/vue-cli/issues/6270#issuecomment-777103686
npm update --legacy-peer-deps
npm audit fix --legacy-peer-deps
I have the same issue. We can't even install or build our projects anymore. The only workaround I've found is the one suggested above, but it feels dirty.
Same problem here with initial install from vue-cli
Node => v16.15.1 Npm => 8.11.0 Vue-cli => 5.0.6
Generated package.json
{
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"vuex": "^3.6.2"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-standard": "^6.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"vue-template-compiler": "^2.6.14"
}
}
Hope it will help
Create an .npmrc file on root with the content legacy-peer-deps=true
how to fix this issue?
To solve this issue simply downgrade the version which is suggested by npm.
For eg. npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @vue/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/eslint npm ERR! peer eslint@">= 4.12.1" from [email protected] npm ERR! node_modules/babel-eslint npm ERR! dev babel-eslint@"^10.1.0" from the root project npm ERR! peer eslint@">=5.0.0" from [email protected] npm ERR! node_modules/vue-eslint-parser npm ERR! vue-eslint-parser@"^7.0.0" from [email protected] npm ERR! node_modules/eslint-plugin-vue npm ERR! dev eslint-plugin-vue@"^6.2.2" from the root project npm ERR! 1 more (the root project) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/[email protected] npm ERR! node_modules/@vue/cli-plugin-eslint npm ERR! dev @vue/cli-plugin-eslint@"^4.5.15" from the root project
Here it is saying
Could not resolve dependency: npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/[email protected]
So please update eslint version between >= 1.6.0 < 7.0.0 in package.json file and then run command npm install If you get any error related to resolving dependency. Please follow this
Thank you.