例如,当我安装Angular2时:
let mediaPicker = MPMediaPickerController(mediaTypes: .music)
mediaPicker.delegate = self
mediaPicker.prompt = "Select song (Icloud songs must be downloaded to use)"
mediaPicker.allowsPickingMultipleItems = false
mediaPicker.showsCloudItems = false
presentViewController(mediaPicker, animated: true, completion: {})
是否有一个可以传递给npm的魔术标志,它也将安装对等依赖项?我还没能找到一个...手动复制和粘贴对等依赖项并确保我有正确的版本是很乏味的。
换句话说,我不必这样做:
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.
更好的方法是什么?
答案 0 :(得分:140)
使用npm 3显式删除了对等依赖项的自动安装,因为它会导致比尝试解决的问题更多的问题。你可以在这里阅读它,例如:
所以不,由于给出的原因,你无法使用npm 3向上自动安装它们。
答案 1 :(得分:27)
我通过重写package.json来解决它,其中包含警告的确切值:
[abc]+
package.json:" es6-shim":" ^ 0.33.3",
s///
package.json:" reflect-metadata":" 0.1.2",
npm WARN angular2@2.0.0-beta.3 requires a peer of es6-shim@^0.33.3 but none was installed.
答案 2 :(得分:15)
在这种情况下和其他情况下有用的作弊代码...
├──未达到对等关系@ 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>
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-保存
答案 3 :(得分:12)
项目npm-install-peers
将检测对等方并安装它们。
从v1.0.1
开始,它不支持自动回写package.json
,这基本上可以解决我们的需求。
请在飞行中添加您的支持:https://github.com/spatie/npm-install-peers/issues/4
答案 4 :(得分:2)
我在开发带有peerDependencies
的npm软件包时遇到了这些错误。我必须确保所有peerDependencies
也被列为devDependencies
。该项目不会自动使用全局安装的软件包。
答案 5 :(得分:0)
安装纱线然后运行
yarn全局添加install-peerdeps
答案 6 :(得分:-1)
执行以下操作:npm install-test