简体   繁体   English

npm ERESOLVE 无法解析依赖树 NestJs Passport

[英]npm ERESOLVE unable to resolve dependency tree NestJs Passport

I have following package.json我有以下 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: ecdisco@1.0.0
npm ERR! Found: passport@0.5.2
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/passport@8.0.1
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我的节点版本是:v16.13.0 我的 npm 版本是:8.1.0

I don't want to use incorrect dependency by using --force and --legacy-peer-deps options.我不想通过使用 --force 和 --legacy-peer-deps 选项来使用不正确的依赖关系。 What solution do I have?我有什么解决方案?

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/passport@8.0.1.要解决此问题,请更新 package.json 中的“passport”库版本:从“passport”:“^0.5.2”到“passport”:“^0.4.0”,因此它与 @nestjs/ 中使用的相同护照@8.0.1。

npm install --save --legacy-peer-deps

that's happens when you use other version from node and npm.当您使用来自节点和 npm 的其他版本时,就会发生这种情况。

  • delete your node_modules folder and try again while you use flag --force删除您的 node_modules 文件夹,然后在使用标志 --force 时重试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ERESOLVE 无法解析依赖树 - ERESOLVE unable to resolve dependency tree ERESOLVE 无法解析 redux 的依赖关系树 - ERESOLVE unable to resolve dependency tree for redux Heroku Shopify 应用程序错误 'npm ERR! ERESOLVE 无法解析依赖树' - Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree' 为什么错误? ERESOLVE unable to resolve dependency tree 被抛出,如何解决? - Why ERR! ERESOLVE unable to resolve dependency tree is thrown and how to resolve it? 安装 AWS CDK 构造库时出现“ERESOLVE 无法解析依赖关系树” - “ERESOLVE unable to resolve dependency tree” when installing AWS CDK construct library npm 安装无法解析依赖树 - npm install unable to resolve dependency tree npm 安装失败(无法解析依赖树) - npm install fails (unable to resolve dependency tree) 无法安装 package Pinia,因为 ERESOLVE 无法解析依赖关系树 - Can't install package Pinia because of ERESOLVE unable to resolve dependency tree npm 错误! 代码 ERESOLVE npm 错误! ERESOLVE 无法解析 npm ERR! 解决时:@nestjs/mongoose@8.0.1 - npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! While resolving: @nestjs/mongoose@8.0.1 npm 安装给了我 npm ERR! ERESOLVE 无法解析 - npm install gaves me npm ERR! ERESOLVE could not resolve
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM