npm install抱怨已经满足的未满足的对等deps

时间:2016-09-21 18:49:15

标签: angular npm npm-install

我刚从rc-6升级到角度2最终版本。我已经在beta / rc版本中多次升级而没有问题。

我的package.json中的代表是:

"dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/compiler-cli": "0.6.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/platform-server": "2.0.0",
    "@angular/router": "3.0.0",
    "@angular/upgrade": "2.0.0",
    "angular2-cookie": "1.2.3",
    "bootstrap-sass": "3.3.6",
    "chart.js": "2.1.6",
    "core-js": "^2.4.1",
    "highlight.js": "9.5.0",
    "marked": "0.3.5",
    "ng2-bootstrap": "1.1.1",
    "ng2-charts": "1.2.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "^0.6.23"
  }

这符合当前的内容(撰写本文时)angular 2 setup page

运行npm install会安装所有内容,但最后会出现一堆错误:

219946 error code EPEERINVALID
219947 error peerinvalid The package @angular/common@2.0.0 does not satisfy its siblings' peerDependencies requirements!
219947 error peerinvalid Peer @angular/forms@2.0.0 wants @angular/common@^2.0.0
219947 error peerinvalid Peer @angular/platform-browser@2.0.0 wants @angular/common@^2.0.0
219947 error peerinvalid Peer @angular/platform-browser-dynamic@2.0.0 wants @angular/common@^2.0.0
219947 error peerinvalid Peer @angular/platform-server@2.0.0 wants @angular/common@^2.0.0
219947 error peerinvalid Peer @angular/router@3.0.0 wants @angular/common@^2.0.0
219947 error peerinvalid Peer ng2-bootstrap@1.1.1 wants @angular/common@2.0.0-rc.6
219947 error peerinvalid Peer ng2-charts@1.2.0 wants @angular/common@2.0.0-rc.6
219948 verbose exit [ 1, true ]

正如你在我的package.json中看到的那样,我在@ angular / common @ 2.0.0上,并没有比当前可用版本更高的版本。目前的设置建议使用^2.0.0,但我尝试了它无论如何也无济于事。

我还尝试过对整个node_modules目录进行nuking,以及在其他任何事情之前安装@ angular / common,两者都没有成功。我是傻瓜,还是还有其他事情发生在这里?

2 个答案:

答案 0 :(得分:0)

当我使用npm install文件运行package.json时,我做了一些能够重现此错误的测试。在angular 2项目中运行npm install之前,你应该有4个文件。在angular.io中,您需要复制以下文件...

-package.json

-tsconfig.json

-typing.json

-systemjs.config.js

将所有这些文件复制到项目后,再次运行NPM安装。 (这些文件嵌套在教程中package.json文件正上方的选项卡中)

答案 1 :(得分:0)

使用npm:

    npm install -g npm
    npm cache clean
    npm update -g
    npm install

或许因为ng2-bootstrap和ng2-charts预先要求@ angular / common的旧版本出现问题?试试新版本?:

  "ng2-bootstrap": "1.1.5",
  "ng2-charts": "1.3.0",