库依赖性问题:不同的库取决于同一库的不同版本

时间:2018-09-21 10:36:20

标签: angular npm webpack angular-cli

我有几个依赖于webpack库的库。

当前,我使用的是4.79.1版本,但是当我使用npm install时,会收到以下警告:

  

karma-webpack@3.0.5需要一个webpack@^2.0.0 ||的同级对象。 ^ 3.0.0但   没有安装。您必须自己安装对等依赖项。

我的第一件事就是降级到3.0.0版本,但是我开始收到以下警告:

enter image description here

如您所见,警告版本中存在的所有库都等于或大于4.0.0

在这种情况下您应该做什么?

遵循我的包裹要求:

"devDependencies": {
    "@angular/common": "^6.1.8",
    "@angular/compiler": "^6.1.8",
    "@angular/compiler-cli": "^6.1.8",
    "@angular/core": "^6.1.8",
    "@angular/forms": "^6.1.8",
    "@angular/http": "^6.1.8",
    "@angular/platform-browser": "^6.1.8",
    "@angular/platform-browser-dynamic": "^6.1.8",
    "@angular/router": "^6.1.8",
    "@compodoc/compodoc": "^1.0.0-beta.7",
    "@types/jasmine": "^2.8.8",
    "@types/lodash": "^4.14.79",
    "@types/node": "~6.0.60",
    "angular2-tinymce": "^2.1.2",
    "codelyzer": "~4.4.4",
    "core-js": "^2.4.1",
    "cropperjs": "^1.0.0-rc.2",
    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-chmod": "^2.0.0",
    "gulp-rename": "^1.2.2",
    "gulp-rollup": "^2.15.0",
    "jasmine": "^3.2.0",
    "jasmine-core": "^2.99.1",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "^1.7.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-html-reporter": "^0.2.7",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-mocha-reporter": "^2.2.5",
    "karma-webpack": "^3.0.5",
    "lodash": "^4.17.4",
    "ngx-bootstrap": "^2.0.0-beta.8",
    "ngx-toastr": "8.1.1",
    "node-sass": "^4.5.2",
    "node-watch": "^0.5.2",
    "protractor": "~5.1.0",
    "puppeteer": "^1.7.0",
    "rollup": "^0.49.3",
    "run-sequence": "^1.2.2",
    "rxjs": "^6.3.2",
    "ts-node": "~2.0.0",
    "tsickle": "^0.33.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2",
    "zone.js": "^0.8.4",
    "webpack": "^4.19.1"
  },
  "engines": {
    "node": ">=6.0.0"
  },
  "dependencies": {
    "@angular-devkit/build-angular": "^0.7.3",
    "@angular/cli": "^6.2.3",
    "jasmin": "0.0.2",
    "rxjs-compat": "^6.0.0-rc.0"
  }

1 个答案:

答案 0 :(得分:1)

您可以尝试通过下一个命令使用karma-webpack软件包的下一个版本:

  

npm i -D karma-webpack @ next

这将安装karma-webpack的下一个(4.0.0-rc.2)版本。

并且不要忘记在稳定发行后更改版本。