我试图开发一个角度项目,我一直在使用cli。我还尝试使用一些其他组件,比如angular handsontableprimeng。我为自己解开了一个巨大的混乱,然而,当我只想看到我已经安装了一些包,包括角度本身的版本时。
例如,如果我想检查primerg的安装版本,我看到我可以做“npm list primerg”。我明白这一点:

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

好吧…这是否意味着没有安装角/公共、编译器、核心和表单?这很奇怪,因为角度是工作。让我查一下…
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

据我所知,似乎不是。但这是my package.json的dependencies部分:
"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安装。有棱角的东西…
怎么了?我认为在package.json中有所有这些@angular行,当我安装npm时,它会安装这些包。

最佳答案

我在遵照指令后解决了同样的问题!

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

09-03 22:35
查看更多