robinvdvleuten / vuex-persistedstate

💾 Persist and rehydrate your Vuex state between page reloads.
https://npm.im/vuex-persistedstate
MIT License
5.77k stars 378 forks source link

Could not resolve peer dependency vuex@"^3.0 || ^4.0" with Vuex 4.0.0-rc.2 installed #370

Open cvisl opened 3 years ago

cvisl commented 3 years ago

Relevant code or config

package.json

{
  "name": "pcit-vr-story-editor",
  "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.6.5",
    "rete": "^1.4.5-rc.1",
    "rete-area-plugin": "^0.2.1",
    "rete-connection-plugin": "^0.9.0",
    "rete-context-menu-plugin": "^0.6.0-rc.1",
    "rete-history-plugin": "^0.2.1",
    "rete-vue-render-plugin": "^0.5.0",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.33.0",
    "@typescript-eslint/parser": "^2.33.0",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0",
    "sass": "^1.26.5",
    "sass-loader": "^8.0.2",
    "typescript": "~3.9.3"
  }
}

What you did:

Try to install vuex-persistedstate with a vue-cli created package.json, nothing special, with:

npm install vuex-persistedstate

What happened:

npm gave the following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: pcit-vr-story-editor@0.1.0
npm ERR! Found: vuex@4.0.0-rc.2
npm ERR! node_modules/vuex
npm ERR!   vuex@"^4.0.0-0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vuex@"^3.0 || ^4.0" from vuex-persistedstate@4.0.0-beta.1
npm ERR! node_modules/vuex-persistedstate
npm ERR!   vuex-persistedstate@"4.0.0-beta.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! See /home/casperl/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/casperl/.npm/_logs/2020-11-26T15_07_53_610Z-debug.log

Problem description:

npm can not resolve the peer dependency vuex@"^3.0 || ^4.0" of vuex-persistedstate eventhough I have a vuex ^4.0 version installed.

Is there a way to install it without using --force or --legacy-peer-deps?

1beb commented 3 years ago

Same problem, bypassed it temporarily with: https://github.com/robinvdvleuten/vuex-persistedstate/pull/374/files by updating the version in peerDependencies. I don't think that style of dependency specification supports anything other than versions with numbers? That's just a guess, I don't know npm that well. I think it has to be parseable which semver, but I don't think the style vuex is using is. https://github.com/npm/node-semver