zachThePerson
zachThePerson

Reputation: 704

"Could not resolve dependency," error when running "vue upgrade"

I am attempting to use the instructions here to install the migration build of Vue 3.

When I get to the point where it tells you to run vue upgrade I select y to install upgrades then it gives me the following error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   vue@"^2.6.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"3.1.5" from @vue/[email protected]
npm ERR! node_modules/@vue/compiler-sfc
npm ERR!   peer @vue/compiler-sfc@"^3.0.0-beta.14" from @vue/[email protected]
npm ERR!   node_modules/@vue/cli-service
npm ERR!     dev @vue/cli-service@"~4.5.13" 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\Zach\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\Zach\AppData\Local\npm-cache\_logs\2021-08-08T22_29_19_955Z-debug.log
 ERROR  command failed: npm install --loglevel error @vue/cli-service@~4.5.13

I've read through the error message, but I'm not sure how to go about solving the issue. I attempted to use --force but it only seemed to cause more issues later.

How would I go about solving this?

Upvotes: 6

Views: 7993

Answers (1)

Trott
Trott

Reputation: 70075

You are likely using npm version 7. (Using npm version 7, I was able to replicate your error based on your error message.) The easiest solutions are:

  • Use npm's --legacy-peer-deps flag
  • Use npm version 6 (where the behavior of npm version 7's --legacy-peer-deps flag is the default)

The tutorial and packages were probably written and tested with npm version 6 (or maybe 5 or 4). Lots of existing projects run into this ERESOLVE error in npm version 7 because that version started treating peer dependencies problems as errors instead of advisory issues that could be ignored.

Upvotes: 13

Related Questions