例如,当我安装Angular2时:
npm install --save angular2
temp@1.0.0 /Users/doug/Projects/dougludlow/temp
├── angular2@2.0.0-beta.3
├── UNMET PEER DEPENDENCY es6-promise@^3.0.2
├── UNMET PEER DEPENDENCY es6-shim@^0.33.3
├── UNMET PEER DEPENDENCY reflect-metadata@0.1.2
├── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.0
└── UNMET PEER DEPENDENCY zone.js@0.5.11
npm WARN angular2@2.0.0-beta.3 requires a peer of es6-promise@^3.0.2 but none was installed.
npm WARN angular2@2.0.0-beta.3 requires a peer of es6-shim@^0.33.3 but none was installed.
npm WARN angular2@2.0.0-beta.3 requires a peer of reflect-metadata@0.1.2 but none was installed.
npm WARN angular2@2.0.0-beta.3 requires a peer of rxjs@5.0.0-beta.0 but none was installed.
npm WARN angular2@2.0.0-beta.3 requires a peer of zone.js@0.5.11 but none was installed.
是否有一个神奇的标志,我可以传递给npm,将安装对等依赖?我还没找到……手动复制和粘贴对等依赖项并确保我有正确的版本是很乏味的。
换句话说,我宁愿不去做:
npm install --save angular2@2.0.0-beta.3 es6-promise@^3.0.2 es6-shim@^0.33.3 reflect-metadata@0.1.2 rxjs@5.0.0-beta.0 zone.js@0.5.11
更好的方法是什么?
作弊代码在这种情况下很有帮助,还有一些其他的…
├── UNMET PEER DEPENDENCY @angular/common@4.0.2
├── UNMET PEER DEPENDENCY @angular/compiler@4.0.2
├── UNMET PEER DEPENDENCY @angular/compiler-cli@4.0.2
├── UNMET PEER DEPENDENCY @angular/core@4.0.2
├── UNMET PEER DEPENDENCY @angular/forms@4.0.2
├── UNMET PEER DEPENDENCY @angular/http@4.0.2
├── UNMET PEER DEPENDENCY @angular/platform-browser@4.0.2
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@4.0.2 >
将错误复制并粘贴到代码编辑器中。
用光标标出不需要的部分。在这种情况下,├──UNMET PEER DEPENDENCY
多次按command + d键。
按两次delete键。(如果不小心高亮了├──UNMET PEER DEPENDENCY,请按空格)
向上按一次。添加npm install
按一下。添加——保存
将您的东西复制回cli并运行
npm install @angular/common@4.0.2 @angular/compiler@4.0.2 @angular/compiler-cli@4.0.2 @angular/core@4.0.2 @angular/forms@4.0.2 @angular/http@4.0.2 @angular/platform-browser@4.0.2 @angular/platform-browser-dynamic@4.0.2 --save
作弊代码在这种情况下很有帮助,还有一些其他的…
├── UNMET PEER DEPENDENCY @angular/common@4.0.2
├── UNMET PEER DEPENDENCY @angular/compiler@4.0.2
├── UNMET PEER DEPENDENCY @angular/compiler-cli@4.0.2
├── UNMET PEER DEPENDENCY @angular/core@4.0.2
├── UNMET PEER DEPENDENCY @angular/forms@4.0.2
├── UNMET PEER DEPENDENCY @angular/http@4.0.2
├── UNMET PEER DEPENDENCY @angular/platform-browser@4.0.2
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@4.0.2 >
将错误复制并粘贴到代码编辑器中。
用光标标出不需要的部分。在这种情况下,├──UNMET PEER DEPENDENCY
多次按command + d键。
按两次delete键。(如果不小心高亮了├──UNMET PEER DEPENDENCY,请按空格)
向上按一次。添加npm install
按一下。添加——保存
将您的东西复制回cli并运行
npm install @angular/common@4.0.2 @angular/compiler@4.0.2 @angular/compiler-cli@4.0.2 @angular/core@4.0.2 @angular/forms@4.0.2 @angular/http@4.0.2 @angular/platform-browser@4.0.2 @angular/platform-browser-dynamic@4.0.2 --save