Home > OS >  vuejs 3 I deleted folder node_modules and now npm install has error
vuejs 3 I deleted folder node_modules and now npm install has error

Time:03-29

I have a work project, but I deleted folder node_modules and now npm install has error.

node v16.13.2 @vue/cli 4.5.15

my package.json

"dependencies": {
    "@capacitor/android": "3.4.3",
    "@capacitor/app": "1.1.0",
    "@capacitor/core": "3.4.1",
    "@capacitor/haptics": "1.1.4",
    "@capacitor/keyboard": "1.2.2",
    "@capacitor/status-bar": "1.0.8",
    "@ionic/vue": "^6.0.9",
    "@ionic/vue-router": "^6.0.0",
    "@popperjs/core": "^2.11.2",
    "axios": "^0.25.0",
    "core-js": "^3.6.5",
    "eslint-loader": "^4.0.2",
    "vue": "^3.2.21",
    "vue-axios": "^3.4.0",
    "vue-router": "^4.0.12",
    "vuex": "^4.0.2"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.17.0",
    "@babel/eslint-plugin": "^7.16.5",
    "@capacitor/cli": "3.4.1",
    "@vue/cli-plugin-babel": "~4.5.15",
    "@vue/cli-plugin-eslint": "~4.5.15",
    "@vue/cli-service": "~4.5.15",
    "@vue/compiler-sfc": "^3.0.0",
    "eslint": "^7.0.0",
    "eslint-plugin-vue": "^7.0.0"
  },

npm install

# npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^7.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-plugin-eslint
npm ERR!   dev @vue/cli-plugin-eslint@"~4.5.15" 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 C:\Users\xxx\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Local\npm-cache\_logs\2022-03-27T14_01_53_031Z-debug.log

How can I fix it? Please help. Thanks in advance.

Error screen https://i.stack.imgur.com/QmLtI.png

CodePudding user response:

It happened to me a while ago, i dont know if the solutions is still going to work but, tried deleting the package.json then use npm init hen run dependency-check in your project directory followed by a npm install

CodePudding user response:

A solution that worked for me was upgrading @vue/cli-plugin-eslint to ^5.0.4 (The ^ means "up to next major").

On a side note, you should keep all your packages as up-to-date as possible for security reasons.

  • Related