programing

Vue3에 Vuex를 설치하지 못했습니다.

minecode 2022. 7. 3. 00:14
반응형

Vue3에 Vuex를 설치하지 못했습니다.

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 의 메뉴얼을 참조해 주세요.

npm install vuex@next --save

Vue2 를 사용하는 경우는, Vuex 3 의 메뉴얼을 참조해 주세요.

npm install vuex --save

해 보세요.npm install vuex@next --savenpm install vuex --save 효과가 있을 것이다.

@Seegy가 말했듯이

  • Vue 3은 Vuex 4를 사용합니다.
  • Vue 2는 Vuex 3을 사용합니다.

2022년 2월 현재

  • Vue 2는 Vue 3을 나타냅니다.
    • npm install vuex@3.4.0 --save
  • Vue 3의 Vue 4의 Vue 4의 Vue 4의 Vue 4의 Vue 4입니다.
    • npm install vuex --save ★★★★★★★★★★★★★★★★★」npm install vuex@next --save

전에도 해봤는데 안 되더라고요.

npm install vuex --save

그래서 이게 나한테 효과가 있었어

npm install vuex@next --save

언급URL : https://stackoverflow.com/questions/68111008/failed-to-install-vuex-in-vue3

반응형