Search code examples
angularng2-bootstrap

Angular2: UNMET PEER DEPENDENCY


I am trying to install bootstrap using npm in Angular2 with this command

npm install --save ng2-bootstrap

But I get following error and warning in console

+-- 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.

Solution

  • You need to upgrade your application to angular2 RC6 version.

    Follow these steps-

    1. Update @angular version to 2.0.0-rc.6 in package.json Refer package.json here

    2. clean your node_modules folder and then run npm install.

    See if this helps.


    EDIT:

    This is how my package.json looks like for angular2 RC6 and ng2-bootstrap 1.1.1 with 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"
      }
    }