【问题标题】:Angular package.json and unmet peer dependenciesAngular package.json 和未满足的对等依赖项
【发布时间】:2017-11-06 16:28:36
【问题描述】:

我正在尝试开发一个 Angular 项目,并且一直在使用 CLI。我也在尝试使用其他一些组件,例如angular handsontableprimeng。然而,当我只是想看看我安装了一些软件包的版本时,包括 Angular 本身,我为自己解开了一个巨大的困惑。

例如,如果我想检查已安装的 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/common、编译器、核心和表单?这很奇怪,因为 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 install 时,它会安装这些包。

【问题讨论】:

    标签: angular npm npm-install package.json


    【解决方案1】:

    按照说明运行后,我已经解决了同样的问题!

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

    【讨论】:

      猜你喜欢
      • 2017-05-21
      • 2018-07-12
      • 2016-08-29
      • 2018-04-16
      • 1970-01-01
      • 2018-01-21
      • 1970-01-01
      • 1970-01-01
      • 2016-12-17
      相关资源
      最近更新 更多