gpt4 book ai didi

vuex - 在 Vue3 中安装 Vuex 失败

转载 作者:行者123 更新时间:2023-12-04 14:43:57 33 4
gpt4 key购买 nike

我想安装 Vuex 但出现错误。

// error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vuejs-v-3@0.1.0
npm ERR! Found: vue@3.1.2
npm ERR! node_modules/vue
npm ERR! vue@"^3.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.0.0" from vuex@3.6.2
npm ERR! node_modules/vuex
npm ERR! vuex@"*" 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/hap/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/hap/.npm/_logs/2021-06-24T06_46_36_463Z-debug.log
// package.json

{
"name": "vuejs-v-3",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@apollo/client": "^3.3.20",
"axios": "^0.21.1",
"bootstrap": "^5.0.2",
"core-js": "^3.6.5",
"graphql": "^15.5.1",
"vue": "^3.1.2",
"vue-router": "^4.0.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

最佳答案

使用Vue3时引用Vuex 4 Documentation安装 Vuex 4 npm install vuex@next --save使用Vue2时,引用Vuex 3 Documentation安装 Vuex 3npm install vuex --save

关于vuex - 在 Vue3 中安装 Vuex 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68111008/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com