简体   繁体   English

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

[英]Angular package.json and unmet peer dependencies

I'm trying to develop an angular project and I've been using the CLI. 我正在尝试开发一个角度项目,我一直在使用CLI。 I'm also trying to use some other components, like the angular handsontable and primeng . 我也试图使用其他一些组件,比如角形指针primeng I unraveled a huge ball of confusion for myself, however, when I just wanted to see what versions of some packages, including angular itself, I have installed. 我为自己解开了一个巨大的混乱球,但是,当我想看看我安装的某些包的版本,包括角度本身。

So for example, if I want to check the installed version of primeng, I saw that I could do `npm list primeng'. 所以例如,如果我想检查primeng的安装版本,我看到我可以做`npm list primeng'。 I get this: 我明白了:

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

Okay so... does that mean angular/common,compiler,core, and forms aren't installed? 好吧......那是不是意味着角度/通用,编译器,核心和表格都没有安装? That's weird since Angular is working. 自Angular工作以来,这很奇怪。 Let me check... 我来看看......

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

It looks like it isn't, from what I can tell. 从我所知道的看来,它看起来并非如此。 But this is the dependencies section of my package.json: 但这是我的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"
  },

and I've done "npm install" in this directory plenty of times. 我已经在这个目录中完成了“npm install”很多次了。 And Angular stuff works... Angular的东西有效......

So what's going on? 发生什么了? I would think that with all of these @angular lines in my package.json that when I npm install, it installs those packages. 我认为在我的package.json中使用所有这些@angular线,当我安装npm时,它会安装这些包。

I've solved same issue after running following instructions! 我按照说明运行后解决了同样的问题!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM