错误通过npm为angular4安装第三方软件包

时间:2017-06-19 00:23:00

标签: angular npm

我尝试通过

安装angular2-datatableloadash
npm install --save angular2-datatable

sudo npm i --save lodash

但是这个错误

reporter-ui@0.0.0 /Users/.../Desktop/reporter-ui
├── UNMET PEER DEPENDENCY @angular/common@4.2.3
├── UNMET PEER DEPENDENCY @angular/core@4.2.3
├── UNMET PEER DEPENDENCY @angular/platform-browser@4.2.3
└── angular2-datatable@0.6.0 

npm WARN angular2-datatable@0.6.0 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angular2-datatable@0.6.0 requires a peer of @angular/common@^2.0.0 but none was installed.
npm WARN angular2-datatable@0.6.0 requires a peer of @angular/platform-browser@^2.0.0 but none was installed.

出现了两次。我该如何更新这些依赖项?如果我做了ng --version

angular-cli: 1.0.0-beta.28.3
node: 7.10.0
os: darwin x64
@angular/animations: 4.2.3
@angular/common: 4.2.3
@angular/compiler: 4.2.3
@angular/core: 4.2.3
@angular/forms: 4.2.3
@angular/http: 4.2.3
@angular/material: 2.0.0-beta.6
@angular/platform-browser: 4.2.3
@angular/platform-browser-dynamic: 4.2.3
@angular/router: 4.2.3
@angular/cli: 1.1.0
@angular/compiler-cli: 4.2.3
@angular/language-service: 4.2.3

我尝试在package.json中手动将版本更改为正确的版本,但我仍然收到错误消息。在我看来,安装了正确的版本,但我如何告诉角度cli和/或npm?另外,我尝试升级npm和angular cli仍然是同样的错误。

1 个答案:

答案 0 :(得分:0)

经过进一步调查后,产生的错误与声明的警告无关。正如评论所述,这些警告可以被忽略,一切都按预期工作。