Home > Software design >  npm ERESOLVE unable to resolve dependency tree NestJs Passport
npm ERESOLVE unable to resolve dependency tree NestJs Passport

Time:01-01

I have following package.json

{
  "dependencies": {
    "@elastic/elasticsearch": "^7.16.0",
    "@nestjs/common": "^8.2.4",
    "@nestjs/config": "^1.1.5",
    "@nestjs/core": "^8.2.4",
    "@nestjs/jwt": "^8.0.0",
    "@nestjs/microservices": "^8.2.4",
    "@nestjs/passport": "^8.0.1",
    "@nestjs/platform-express": "^8.2.4",
    "@nestjs/testing": "^8.2.4",
    "@nestjs/websockets": "^8.2.4",
    "@nuxt/content": "^1.15.1",
    "@nuxt/typescript": "^2.8.1",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/pwa": "^3.3.5",
    "@riophae/vue-treeselect": "0.4.0",
    "@typegoose/typegoose": "^9.4.0",
    "@types/fabric": "^4.5.6",
    "@types/multer": "^1.4.7",
    "acorn": "^8.6.0",
    "adm-zip": "^0.5.9",
    "ajv": "^8.8.2",
    "amqplib": "^0.8.0",
    "animejs": "^3.2.1",
    "axios": "^0.24.0",
    "bootstrap": "^5.1.3",
    "connect-mongo": "^4.6.0",
    "copyfiles": "^2.4.1",
    "core-js": "^3.20.1",
    "cross-env": "^7.0.3",
    "element-theme-dark": "^1.0.3",
    "element-ui": "^2.15.6",
    "express": "^4.17.2",
    "express-session": "^1.17.2",
    "fabric": "^4.6.0",
    "file-saver": "^2.0.5",
    "glob": "^7.2.0",
    "http-status-codes": "^2.1.4",
    "jQuery-QueryBuilder": "^2.6.2",
    "jquery": "^3.6.0",
    "jquery-ui-dist": "^1.13.0",
    "material-icons": "^1.10.4",
    "mongodb": "^4.2.2",
    "mongoose": "^6.1.3",
    "multer": "^1.4.4",
    "node-cron": "^3.0.0",
    "nprogress": "^0.2.0",
    "nuxt": "^2.15.8",
    "nuxt-class-component": "^1.3.0",
    "oidc-client": "^1.11.5",
    "openid-client": "^5.1.1",
    "passport": "^0.5.2",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "popper.js": "^1.16.1",
    "redis": "^4.0.1",
    "reflect-metadata": "^0.1.13",
    "regenerator-runtime": "^0.13.9",
    "register-service-worker": "^1.7.2",
    "rimraf": "^3.0.2",
    "rxjs": "^7.4.0",
    "splitpanes": "^2.3.8",
    "ts-loader": "^9.2.6",
    "typegoose": "^5.9.1",
    "typeorm": "^0.2.41",
    "typescript": "^4.5.4",
    "vue": "^2.6.14",
    "vue-class-component": "^7.2.6",
    "vue-context": "^6.0.0",
    "vue-drag-drop": "^1.1.4",
    "vue-grid-layout": "^2.3.12",
    "vue-property-decorator": "^9.1.2",
    "vue-quill-editor": "^3.0.6",
    "vue-router": "^3.5.3",
    "vue-runtime-helpers": "^1.1.2",
    "vue-server-renderer": "^2.6.14",
    "vue-simple-uploader": "^0.7.6",
    "vuetify": "^2.6.1",
    "vuetify-loader": "^1.7.3",
    "vuex-class": "^0.3.2",
    "vuex-class-component": "^2.3.6",
    "webpack-node-externals": "^3.0.0",
    "winston": "^3.3.3"
  },
  "devDependencies": {
    "@babel/plugin-transform-modules-commonjs": "^7.16.5",
    "@nuxt/config": "^2.15.8",
    "@nuxt/types": "^2.15.8",
    "@nuxt/typescript-build": "^2.1.0",
    "@nuxtjs/stylelint-module": "^4.1.0",
    "@types/adm-zip": "^0.4.34",
    "@types/amqplib": "^0.8.2",
    "@types/animejs": "^3.1.4",
    "@types/chai": "^4.3.0",
    "@types/file-saver": "^2.0.4",
    "@types/jest": "^27.0.3",
    "@types/jquery": "^3.5.11",
    "@types/jqueryui": "^1.12.16",
    "@types/mocha": "^9.0.0",
    "@types/mongodb": "^4.0.6",
    "@types/node": "^17.0.4",
    "@types/nprogress": "0.2.0",
    "@types/quill": "^2.0.9",
    "@types/redis": "^4.0.10",
    "@types/splitpanes": "^2.2.1",
    "@types/webpack-env": "^1.16.3",
    "@typescript-eslint/eslint-plugin": "^5.8.0",
    "@typescript-eslint/eslint-plugin-tslint": "^5.8.0",
    "@typescript-eslint/parser": "^5.8.0",
    "@vue/cli-plugin-babel": "^4.5.15",
    "@vue/cli-plugin-e2e-cypress": "^4.5.15",
    "@vue/cli-plugin-pwa": "^4.5.15",
    "@vue/cli-plugin-typescript": "^4.5.15",
    "@vue/cli-plugin-unit-mocha": "^4.5.15",
    "@vue/cli-service": "^4.5.15",
    "@vue/test-utils": "^1.3.0",
    "babel-plugin-component": "^1.1.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "chai": "^4.3.4",
    "eslint": "^8.5.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsdoc": "^37.4.0",
    "eslint-plugin-no-null": "^1.0.2",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-unicorn": "^39.0.0",
    "jest": "^27.4.5",
    "lint-staged": "^12.1.4",
    "node-sass": "^7.0.0",
    "nodemon": "^2.0.15",
    "nuxt-property-decorator": "^2.9.1",
    "nuxt-ts": "^2.8.1",
    "prettier": "^2.5.1",
    "sass-loader": "^12.4.0",
    "stylus": "^0.56.0",
    "stylus-loader": "^6.2.0",
    "ts-node": "^10.4.0",
    "tsconfig-paths": "^3.12.0",
    "tslint": "^5.20.1",
    "tslint-config-prettier": "^1.18.0",
    "tslint-plugin-prettier": "^2.3.0",
    "vue-template-compiler": "^2.6.14",
    "webpack": "^5.65.0",
    "webpack-cli": "^4.9.1",
    "webpack-shell-plugin": "^0.5.0"
  }
}

when I try to install above dependencies I am getting following error.

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/passport
npm ERR!   passport@"^0.5.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer passport@"^0.4.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/passport
npm ERR!   @nestjs/passport@"^8.0.1" 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\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.

My Node version is: v16.13.0 My npm version is: 8.1.0

I don't want to use incorrect dependency by using --force and --legacy-peer-deps options. What solution do I have?

CodePudding user response:

To resolve this issue update the "passport" lib version in your package.json: from "passport": "^0.5.2", to "passport": "^0.4.0", so it's same as used in @nestjs/[email protected].

  • Related