一、安装Vuex报错(npm install vuex --save)

这时如果直接安装vuex,不指定版本的话,就会直接安装最新的vuex的版本。所以会出现报错。报错如下:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree 

二、解决方案:

首先检查一下适应的Vuex版本号,再决定安装什么版本。

1.检查适应版本(npm view vuex versions --json)

npm view vuex versions --json
//输出
[
  "0.1.0",
  "0.2.0",
  "0.3.0",
  "0.4.0",
  "0.4.1",
  "0.4.2",
  "0.5.0",
  "0.5.1",
  "0.6.1",
  "0.6.2",
  "0.6.3",
  "0.7.0",
  "0.7.1",
  "0.8.0",
  "0.8.1",
  "0.8.2",
  "1.0.0-rc",
  "1.0.0-rc.2",
  "1.0.0",
  "1.0.1",
  "2.0.0-rc.1",
  "2.0.0-rc.3",
  "2.0.0-rc.4",
  "2.0.0-rc.5",
  "2.0.0-rc.6",
  "2.0.0",
  "2.1.0",
  "2.1.1",
  "2.1.2",
  "2.1.3",
  "2.2.0",
  "2.2.1",
  "2.3.0",
  "2.3.1",
  "2.4.0",
  "2.4.1",
  "2.5.0",
  "3.0.0",
  "3.0.1",
  "3.1.0",
  "3.1.1",
  "3.1.2",
  "3.1.3",
  "3.2.0",
  "3.3.0",
  "3.4.0",
  "3.5.0",
  "3.5.1",
  "3.6.0",
  "3.6.1",
  "3.6.2",
  "4.0.0-alpha.1",
  "4.0.0-beta.1",
  "4.0.0-beta.2",
  "4.0.0-beta.3",
  "4.0.0-beta.4",
  "4.0.0-rc.1",
  "4.0.0-rc.2",
  "4.0.0",
  "4.0.1",
  "4.0.2"
]

2、安装特定的版本,如版本3.6.2

npm install vuex@3.6.2

 安装成功,然后查看package.json文件,可以看到vuex版本为@3.6.2:

 就到这~

Logo

前往低代码交流专区

更多推荐