Angular2:未满足的同伴依赖

Angular2: UNMET PEER DEPENDENCY

我正在尝试使用此命令在 Angular2 中使用 npm 安装 bootstrap

npm install --save ng2-bootstrap

但是我在控制台中收到以下错误和警告

+-- UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
+-- UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
+-- UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
+-- UNMET PEER DEPENDENCY @angular/forms@0.3.0
+-- ng2-bootstrap@1.1.1 
`-- UNMET PEER DEPENDENCY webpack@^1.9.11

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or   architecture: fsevents@1.0.14
npm WARN extract-text-webpack-plugin@1.0.1 requires a peer of   webpack@^1.9.11 but none was installed.
npm WARN ng2-bootstrap@1.1.1 requires a peer of @angular/common@2.0.0-rc.6 but none was installed.
npm WARN ng2-bootstrap@1.1.1 requires a peer of @angular/compiler@2.0.0-rc.6 but none was installed.
npm WARN ng2-bootstrap@1.1.1 requires a peer of @angular/core@2.0.0-rc.6 but none was installed.
npm WARN ng2-bootstrap@1.1.1 requires a peer of @angular/forms@2.0.0-rc.6 but none was installed.

您需要将您的应用程序升级到angular2 RC6 版本。

按照这些步骤-

  1. 更新@angular版本到2.0.0-rc.6 in package.json Refer package.json here

  2. 清理您的 node_modules 文件夹,然后 运行 npm install。

看看这是否有帮助。


编辑:

这就是我的 package.json 对于 angular2 RC6 和 ng2-bootstrap 1.1.1 和 angular-cli

的样子
{
  "name": "angular2-rc6-cli-ng2bootstrap-8-sep",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "postinstall": "typings install",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0-rc.6",
    "@angular/compiler": "2.0.0-rc.6",
    "@angular/compiler-cli": "0.6.0",
    "@angular/core": "2.0.0-rc.6",
    "@angular/forms": "2.0.0-rc.6",
    "@angular/http": "2.0.0-rc.6",
    "@angular/platform-browser": "2.0.0-rc.6",
    "@angular/platform-browser-dynamic": "2.0.0-rc.6",
    "@angular/platform-server": "2.0.0-rc.6",
    "@angular/router": "3.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.6",
    "es6-shim": "0.35.1",
    "ng2-bootstrap": "^1.1.1",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.11",
    "systemjs": "0.19.26",
    "zone.js": "^0.6.17"
  },
  "devDependencies": {
    "angular-cli": "1.0.0-beta.10",
    "codelyzer": "0.0.20",
    "ember-cli-inject-live-reload": "1.4.0",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "0.13.22",
    "karma-chrome-launcher": "0.2.3",
    "karma-jasmine": "0.3.8",
    "protractor": "3.3.0",
    "ts-node": "0.5.5",
    "tslint": "3.11.0",
    "typescript": "2.0.2",
    "typings": "1.3.1"
  }
}