Angular2 @ angular / material unmet依赖

时间:2016-10-24 06:45:38

标签: angular npm angular-material

我已经从npm安装了angular2材料。现在我想安装另一个包,但它给出了错误

npm ERR! peerinvalid The package @angular/common@2.0.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/forms@2.0.2 wants @angular/common@2.0.2
npm ERR! peerinvalid Peer @angular/material@2.0.0-alpha.9-3 wants @angular/common@^2.0.0
npm ERR! peerinvalid Peer @angular/platform-browser@2.0.2 wants @angular/common@2.0.2
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@2.0.2 wants @angular/common@2.0.2
npm ERR! peerinvalid Peer @angular/router@3.0.2 wants @angular/common@2.0.2
npm ERR! peerinvalid Peer @angular/platform-server@2.1.0 wants @angular/common@2.1.0

我使用的是@angular/material的最新版本,但它取决于@angular/common@^2.0.0。我该怎么做才能解决冲突并使用这些包?

的package.json:

{
  "name": "materialdesign",
  "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.0.0",
    "@angular/compiler": "~2.0.0",
    "@angular/core": "~2.0.0",
    "@angular/forms": "~2.0.0",
    "@angular/http": "~2.0.0",
    "@angular/material": "^2.0.0-alpha.9-3",
    "@angular/platform-browser": "~2.0.0",
    "@angular/platform-browser-dynamic": "~2.0.0",
    "@angular/router": "~3.0.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "watchman": "^0.1.8",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.17",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "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.2"
  }
}

1 个答案:

答案 0 :(得分:1)

听起来像是一个依赖解决问题;我有一个类似的问题,通过这些步骤修复:

  1. 升级至latest NodeJS version
  2. npm --version并确保它是3.10.x
  3. npm install
  4. npm rebuild