NodeJS NPM ERESOLVE无法解析依赖关系树

s5a0g9ez  于 2023-04-05  发布在  Node.js
关注(0)|答案(2)|浏览(177)

这个问题是重复的。我试着在这个项目上运行像npm inpm installnpm update等命令,我从私人git仓库中获取。没有效果。我已经尝试删除package-lock.json和node_modules并运行相同的命令来更新,但却得到了这个错误日志。尝试了现有的解决方案,但没有解决问题:错误日志:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: endless@0.0.0
npm ERR! Found: @angular/core@13.0.3
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~13.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.12" from @angular/common@13.3.12
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^13.0.3" 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!
npm ERR! For a full report see:
npm ERR!

这是我的package.json

{
  "name": "******",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --disableHostCheck=true",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "'": "github:angular/router",
    "@agm/core": "^1.1.0",
    "@angular-devkit/architect": "^0.1300.4",
    "@angular-devkit/core": "^13.0.4",
    "@angular-devkit/schematics": "^13.0.4",
    "@angular/animations": "~13.0.3",
    "@angular/cdk": "^11.0.1",
    "@angular/common": "^13.0.3",
    "@angular/compiler": "~13.0.3",
    "@angular/core": "~13.0.3",
    "@angular/fire": "^5.4.2",
    "@angular/forms": "^13.0.3",
    "@angular/localize": "^13.0.3",
    "@angular/platform-browser": "^13.0.3",
    "@angular/platform-browser-dynamic": "~13.0.3",
    "@angular/platform-server": "^13.0.3",
    "@angular/router": "~13.0.3",
    "@asymmetrik/ngx-leaflet": "^6.0.1",
    "@kolkov/angular-editor": "^1.0.2",
    "@ks89/angular-modal-gallery": "^7.2.5",
    "@ng-bootstrap/ng-bootstrap": "^5.2.2",
    "@ng-select/ng-select": "^10.0.1",
    "@ngx-translate/core": "^12.0.0",
    "@ngx-translate/http-loader": "^4.0.0",
    "@schematics/angular": "^9.0.1",
    "@schematics/update": "^0.900.1",
    "@swimlane/ngx-charts": "^13.0.2",
    "@swimlane/ngx-datatable": "^16.0.3",
    "@types/jquery": "^3.5.14",
    "angular-archwizard": "^5.0.0",
    "angular-calendar": "^0.28.2",
    "angular-count-to": "0.0.3",
    "angular-custom-tour": "0.0.18",
    "angular-datatables": "^13.0.0",
    "angular-ui-tour": "^0.9.4",
    "angular-vertical-timeline": "^0.6.0",
    "angular2-knob": "^1.1.15",
    "angular2-multiselect-dropdown": "^4.6.3",
    "angular2_photoswipe": "^8.0.1",
    "angularx-flatpickr": "^6.2.0",
    "animate": "^1.0.0",
    "animate.css": "^3.7.0",
    "bootstrap": "^4.4.1",
    "bootstrap-vertical-tabs": "^1.2.2",
    "chart.js": "^2.9.3",
    "chartist": "^0.11.4",
    "chartjs-plugin-streaming": "^1.8.0",
    "chokidar": "^3.4.3",
    "core-js": "^3.6.4",
    "datatables.net": "^1.13.1",
    "datatables.net-buttons": "^2.3.5",
    "datatables.net-buttons-dt": "^2.3.5",
    "datatables.net-dt": "^1.13.1",
    "date-fns": "^2.9.0",
    "feather-icons": "^4.26.0",
    "firebase": "^7.8.1",
    "flatpickr": "^4.6.3",
    "hammerjs": "^2.0.8",
    "jquery": "^3.6.2",
    "jszip": "^3.10.1",
    "knob": "^1.1.0",
    "leaflet": "^1.6.0",
    "lodash-es": "^4.17.15",
    "mat-select-search": "^1.2.21",
    "mousetrap": "^1.6.5",
    "ng-animate": "^0.3.4",
    "ng-chartist": "^4.1.0",
    "ng-select2": "^1.4.1",
    "ng2-charts": "^2.3.0",
    "ng2-ckeditor": "^1.2.6",
    "ng2-dragula": "^2.1.1",
    "ng2-file-upload": "^1.4.0",
    "ng2-google-charts": "^5.0.0",
    "ng2-search-filter": "^0.5.1",
    "ng4-date-countdown-timer": "^1.0.4",
    "ng5-slider": "^1.2.4",
    "ngx-bootstrap": "^5.3.2",
    "ngx-ckeditor": "^8.0.0",
    "ngx-cookie-service": "^2.3.0",
    "ngx-countdown-timer": "^0.1.9",
    "ngx-crystal-gallery": "^1.1.5",
    "ngx-dropzone-wrapper": "^9.0.0",
    "ngx-image-cropper": "^3.0.3",
    "ngx-loading": "^15.0.0",
    "ngx-masonry": "^1.1.4",
    "ngx-masonry-gallery": "^3.0.0",
    "ngx-owl-carousel-o": "^2.0.3",
    "ngx-perfect-scrollbar": "^9.0.0",
    "ngx-print": "^1.2.0-beta.3",
    "ngx-rangeslider-component": "^1.0.6",
    "ngx-spinner": "^8.1.0",
    "ngx-toastr": "^12.0.0",
    "photoswipe": "^4.1.3",
    "rxjs": "~6.6.3",
    "rxjs-compat": "~6.5.5",
    "sass": "^1.29.0",
    "screenfull": "^5.0.1",
    "select2": "^4.1.0-rc.0",
    "sweetalert2": "^9.7.2",
    "webpack-dev-server": "^3.10.3",
    "xlsx": "^0.18.5",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.0.4",
    "@angular/cli": "^13.0.4",
    "@angular/compiler-cli": "~13.0.3",
    "@angular/language-service": "~13.0.3",
    "@types/chartist": "^0.9.47",
    "@types/datatables.net": "^1.10.21",
    "@types/datatables.net-buttons": "^1.4.7",
    "@types/hammerjs": "^2.0.36",
    "@types/jasmine": "~3.5.3",
    "@types/jasminewd2": "~2.0.8",
    "@types/leaflet": "^1.5.8",
    "@types/mousetrap": "^1.6.3",
    "@types/node": "^13.7.0",
    "codelyzer": "~5.2.1",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "ng2-completer": "^3.0.3",
    "node-sass": "^5.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.6.2",
    "tslint": "~6.1.0",
    "typescript": "~4.4.4"
  }
}

我已经授予this和其他相关。没有工作。

qlvxas9a

qlvxas9a1#

如何读取npm ERESOLVE日志?

从底部到顶部阅读:

@angular/common@"^13.0.3" 
  installs @angular/common@"13.3.12"
  and depends on @angular/core@"13.3.12"
  but found @angular/core@13.0.3

所以,这意味着@angular/common和@angular/core有不同的版本。要解决这个问题,您应该将它们带到相同的版本,例如“~13.0.3”或“^13.0.3”。但这不会解决您的问题,因为这样其他一些依赖项将无法加载。
下一步:临时删除agm/core(稍后重新添加)并尝试npm i。这将导致另一个问题,但这是要走的路。

tf7tbtn2

tf7tbtn22#

我尝试了所有建议的可能方法来解决这个问题,但有太多的弃用和删除的依赖项。我通过将我的package.json文件替换为angular存储库中的package.json来解决这个问题。希望它有帮助。找到它here
虽然我现在遇到了tsconfig.json的问题
分享我的新***package.json***给其他人看:

{
    "name": "******",
    "version": "1.0.0",
    "description": "QuickStart package.json from the documentation, supplemented with testing support",
    "scripts": {
        "ng": "ng",
        "build": "tsc -p src/",
        "build:watch": "tsc -p src/ -w",
        "build:e2e": "tsc -p e2e/",
        "serve": "lite-server -c=bs-config.json",
        "serve:e2e": "lite-server -c=bs-config.e2e.json",
        "prestart": "npm run build",
        "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
        "pree2e": "npm run build:e2e",
        "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
        "preprotractor": "webdriver-manager update",
        "protractor": "protractor protractor.config.js",
        "pretest": "npm run build",
        "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
        "pretest:once": "npm run build",
        "test:once": "karma start karma.conf.js --single-run",
        "lint": "tslint ./src/**/*.ts -t verbose"
    },
    "keywords": [],
    "author": "",
    "license": "MIT",
    "dependencies": {
        "@angular/common": "^15.2.5",
        "@angular/compiler": "^15.2.5",
        "@angular/core": "~4.3.4",
        "@angular/forms": "^15.2.5",
        "@angular/http": "~4.3.4",
        "@angular/platform-browser": "^15.2.5",
        "@angular/platform-browser-dynamic": "^15.2.5",
        "@angular/router": "^15.2.5",
        "angular-in-memory-web-api": "^0.15.0",
        "core-js": "^2.4.1",
        "rxjs": "5.0.1",
        "systemjs": "0.19.40",
        "zone.js": "^0.8.4"
    },
    "devDependencies": {
        "@types/jasmine": "2.5.36",
        "@types/node": "^6.0.46",
        "canonical-path": "0.0.2",
        "concurrently": "^3.2.0",
        "jasmine-core": "~2.4.1",
        "karma": "^6.4.1",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-jasmine": "^1.0.2",
        "karma-jasmine-html-reporter": "^0.2.2",
        "lite-server": "^2.2.2",
        "lodash": "^4.16.4",
        "protractor": "^7.0.0",
        "rimraf": "^2.5.4",
        "tslint": "^6.1.3",
        "typescript": "~2.1.0"
    },
    "repository": {}
}

相关问题