2017-02-01 78 views
0

我想安裝ng bootstrap,但得到的錯誤似乎是錯誤。以下是我運行安裝時得到的消息,下面是我的package.json文件。Angular Bootstrap安裝錯誤

Dan:solomon-2 dp$ npm install --save @ng-bootstrap/ng-bootstrap 
[email protected] /Users/dp/solomon-2 
├── UNMET PEER DEPENDENCY @angular/[email protected] invalid 
├── UNMET DEPENDENCY @angular/[email protected]~2.4.0 
├── UNMET PEER DEPENDENCY @angular/[email protected] invalid 
└── @ng-bootstrap/[email protected]alpha.19 

npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ngtools/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ngtools/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ngtools/[email protected] requires a peer of @angular/[email protected]^2.3.1 but none was installed. 
npm WARN @ngtools/[email protected] requires a peer of @angular/[email protected]^0.5.0 but none was installed. 

{ 
    "name": "solomon-2", 
    "version": "0.0.0", 
    "license": "MIT", 
    "angular-cli": {}, 
    "scripts": { 
    "start": "ng serve", 
    "lint": "tslint \"src/**/*.ts\"", 
    "test": "ng test", 
    "pree2e": "webdriver-manager update", 
    "e2e": "protractor" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular/common": "~2.4.0", 
    "@angular/compiler": "~2.4.0", 
    "@angular/core": "~2.4.0", 
    "@angular/forms": "~2.4.0", 
    "@angular/http": "~2.4.0", 
    "@angular/platform-browser": "~2.4.0", 
    "@angular/platform-browser-dynamic": "~2.4.0", 
    "@angular/router": "~3.4.0", 
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.19", 
    "core-js": "^2.4.1", 
    "rxjs": "5.0.1", 
    "systemjs": "0.19.40", 
    "ts-helpers": "^1.1.1", 
    "zone.js": "^0.7.4" 
    }, 
    "devDependencies": { 
    "@angular/compiler": "2.4.0", 
    "@angular/compiler-cli": "2.3.1", 
    "@types/jasmine": "2.5.38", 
    "@types/node": "^6.0.42", 
    "angular-cli": "1.0.0-beta.21", 
    "codelyzer": "~1.0.0-beta.3", 
    "jasmine-core": "2.5.2", 
    "jasmine-spec-reporter": "2.5.0", 
    "karma": "1.2.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-jasmine": "^1.0.2", 
    "karma-remap-istanbul": "^0.2.1", 
    "protractor": "4.0.9", 
    "ts-node": "1.2.1", 
    "tslint": "3.13.0", 
    "typescript": "~2.0.3", 
    "webdriver-manager": "10.2.5" 
    } 
} 

回答

1

使用最新的angular2(@angular)庫版本。錯誤消息顯示所需的ng2-bootatrap @ angular/core @〜2.4.0,@ angular/common @ 2.2.1 etc ...

1

沒有錯誤,只是關於ng-bootstrap引起的未滿足的對等依賴的一些警告列出@angular/[email protected]^2.3.1, @angular/[email protected]^2.3.1 and @angular/[email protected]^2.3.1作爲依賴項,並且已安裝2.4.0版。 Npm使用semver進行版本控制,因此^2.3.1 !== 2.4.0