Angular package.json和未满足的对等依赖项

时间:2017-06-05 19:57:35

标签: angular npm npm-install package.json

我正在尝试开发一个角度项目,我一直在使用CLI。我还尝试使用其他一些组件,例如angular handsontableprimeng。我为自己解开了一个巨大的混乱球,然而,当我想看看我安装了哪些包的版本,包括角本身。

所以例如,如果我想检查primeng的安装版本,我看到我可以做`npm list primeng'。我明白了:

C:\Code\path-to-my-project>npm list primeng
+-- UNMET PEER DEPENDENCY @angular/common@4.1.3
+-- UNMET PEER DEPENDENCY @angular/compiler@4.1.3
+-- UNMET PEER DEPENDENCY @angular/core@4.1.3
+-- UNMET PEER DEPENDENCY @angular/forms@4.1.3
`-- primeng@4.0.3

npm ERR! peer dep missing: @angular/common@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/compiler@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/core@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/forms@^2.3.1, required by ng2-handsontable@0.48.0

好的......那是不是意味着角度/通用,编译器,核心和表单都没有安装?自Angular工作以来,这很奇怪。我来看看......

C:\Code\path-to-my-project>npm list @angular/common
+-- UNMET PEER DEPENDENCY @angular/common@4.1.3
+-- UNMET PEER DEPENDENCY @angular/compiler@4.1.3
+-- UNMET PEER DEPENDENCY @angular/core@4.1.3
`-- UNMET PEER DEPENDENCY @angular/forms@4.1.3

npm ERR! peer dep missing: @angular/common@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/compiler@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/core@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! peer dep missing: @angular/forms@^2.3.1, required by ng2-handsontable@0.48.0
npm ERR! code 1

从我能说的话看,它看起来并非如此。但这是我的package.json的依赖项部分:

"dependencies": {
    "@angular/animations": "^4.1.2",
    "@angular/common": "^4.1.3",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/forms": "^4.1.3",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "ng2-handsontable": "^0.48.0",
    "primeng": "^4.0.0",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },

我已经在这个目录中完成了“npm install”很多次了。而Angular的作品......

那是怎么回事?我认为在我的package.json中使用所有这些@angular线,当我安装npm时,它会安装这些包。

1 个答案:

答案 0 :(得分:0)

我按照以下说明操作后解决了同样的问题!

    npm install npm -g
    npm install --save-dev @angular/cli@latest
    npm install
    npm start