Npm install强制升级到Angular 7后自行安装对等依赖项

时间:2018-11-01 22:43:29

标签: angular angular7

我最近将我的angular应用程序从6升级到了7。当我执行npm安装时,angular cli建议您自己安装对等依赖项。例如,当我尝试通过以下命令安装对等项依赖关系时:

npm install @angular/common@^7.0.0

它将在依赖项部分添加一个条目。因此,当我一一安装时,将在依赖项下添加相应软件包的条目。所以最后我在两个地方得到了相同的软件包条目。那有意义吗。我做错什么了吗?我了解的是,对等方依赖项仅在发布程序包时使用,因此我可以忽略警告是正确的还是我需要安装所有对等方依赖项

原始package.json:

{
  "name": "@wtw/toolkit",
  "version": "44.0.5",
  "license": "MIT",
  "dependencies": {
    "@angular/cli": "^7.0.4",
    "deep-diff": "1.0.2",
    "moment": "^2.22.2",
    "ng-click-outside": "^4.0.0"
  },
  "peerDependencies": {
    "@angular/common": "^7.0.0",
    "@angular/compiler": "^7.0.0",
    "@angular/core": "^7.0.0",
    "@angular/forms": "^7.0.0",
    "@angular/http": "^7.0.0",
    "@angular/platform-browser": "^7.0.0",
    "@angular/platform-browser-dynamic": "^7.0.0",
    "@angular/router": "^7.0.0",
    "core-js": "^2.5.7",
    "rxjs": "^6.3.3",
    "zone.js": "^0.8.26"
  }
}

运行npm安装后,出现以下警告消息:

npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/common@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/compiler@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/forms@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/http@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/platform-browser@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/platform-browser-dynamic@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of @angular/router@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of core-js@^2.5.7 but none is installed. You must install peer dependencies yourself.
npm WARN @wtw/toolkit@44.0.5 requires a peer of zone.js@^0.8.26 but none is installed. You must install peer dependencies yourself.
npm WARN ng-click-outside@4.0.0 requires a peer of @angular/common@>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-click-outside@4.0.0 requires a peer of @angular/core@>=6.0.0 but none is installed. You must install peer dependencies yourself.

我的新package.json要

{
  "name": "@wtw/platform",
  "version": "44.0.15",
  "license": "MIT",
  "dependencies": {
    "@angular/core": "^7.0.1",
    "@ngx-translate/core": "^11.0.0",
    "@ngx-translate/http-loader": "4.0.0",
    "@types/google.analytics": "0.0.39",
    "@wtw/toolkit": "44.0.5",
    "bootstrap": "4.1.3",
    "jsoneditor": "^5.24.7",
    "ng2-file-upload": "^1.3.0",
    "ngx-bootstrap": "3.0.1",
    "ngx-cookie-service": "^1.0.10",
    "ngx-jsoneditor": "^0.1.1",
    "ngx-perfect-scrollbar": "6.3.1"
  },
  "peerDependencies": {
    "@angular/core": "^7.0.1",
    "jquery": "^3.3.1",
    "@angular/animations": "^7.0.1",
    "popper.js": "^1.14.3",
    "@angular/compiler": "^7.0.1",
    "@angular/common": "^7.0.1",
    "@angular/forms": "^7.0.1",
    "@angular/http": "^7.0.1",
    "@angular/platform-browser": "^7.0.1",
    "@angular/platform-browser-dynamic": "^7.0.1",
    "@angular/router": "^7.0.1",
    "core-js": "^2.5.7",
    "rxjs": "^6.3.3",
    "zone.js": "^0.8.26"
  }
}

0 个答案:

没有答案