Viraj Madhushan
Viraj Madhushan

Reputation: 91

Vuex can not install using npm and it give an error

When I try to install Vuex using NPM commands, it gives this error.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   dev vue@"^2.6.12" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0.2" from [email protected]
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/viraj/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/viraj/.npm/_logs/2022-06-23T16_10_55_210Z-debug-0.log

I tried using npm install vuex --save and npm install vuex@next --save as well. But both of them not work for me. Why is this happen? And I will be really appreciate if anyone can give some solution for this.

Note : I'm using Vue js with my Laravel project. Here is my package.json file for further refrence.

{
    "private": true,
    "scripts": {
        "dev": "npm run development -- --watch",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production",
        "lint": "eslint resources/js"
    },
    "devDependencies": {
        "@popperjs/core": "^2.10.2",
        "axios": "^0.21.4",
        "bootstrap": "^5.1.3",
        "deepmerge": "^4.2.2",
        "eslint": "^8.16.0",
        "eslint-plugin-vue": "^9.1.0",
        "laravel-mix": "^6.0.44",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.32.13",
        "sass-loader": "^11.1.1",
        "vue": "^2.6.12",
        "vue-loader": "^15.9.8",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "vue-feather-icons": "^5.1.0",
        "vuetify": "^2.6.6"
    }
}

Upvotes: 2

Views: 647

Answers (1)

Nikola Pavicevic
Nikola Pavicevic

Reputation: 23480

You have vue2 so you need vuex3 not 4

npm install [email protected] --save

Upvotes: 3

Related Questions