2017-02-01 58 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