简体   繁体   English

如何覆盖npm peerinvalid

[英]How to override npm peerinvalid

I'm attempting to install a node module that has specified a peerDependencies to an older version of a package. 我正在尝试安装一个节点模块,该模块已为较旧版本的软件包指定了peerDependencies I know that module will work with the newer version. 我知道该模块将与较新版本一起使用。 How can I tell npm to ignore the peerinvalid error? 如何告诉npm忽略peerinvalid错误? Currently the peerinvalid error is stoping the installation process. 当前, peerinvalid错误正在停止安装过程。

This is the error: 这是错误:

npm ERR! peerinvalid Peer xxx@x.x.x wants xxx@x.x.x

Thanks! 谢谢!

A really hacky/temporary workaround is to modify the package.json of the installed packages with the peerDependency specified, deleting the lines that specify react as a peerDependency. 一个真正的hacker / temporary解决方法是使用指定的peerDependency修改已安装软件包的package.json,删除指定作为对等依赖的行。

This hack will go away if you (or a colleague) need to npm install your package's requirements from scratch. 如果您(或同事)需要从头开始npm install软件包的要求,则此技巧将消失。 Like I said, a crappy temporary workaround. 就像我说的,一个糟糕的临时解决方法。

In NPM v3 peer dependancies show a warning instead of an error. 在NPM v3中,对等关系显示警告而不是错误。

We will also be changing the behavior of peerDependencies in npm@3. 我们还将在npm @ 3中更改peerDependencies的行为。 We won't be automatically downloading the peer dependency anymore. 我们将不再自动下载对等依赖项。 Instead, we'll warn you if the peer dependency isn't already installed. 相反,如果尚未安装对等依赖项,我们会警告您。 This requires you to resolve peerDependency conflicts yourself, manually, but in the long run this should make it less likely that you'll end up in a tricky spot with your packages' dependencies. 这需要您手动解决peerDependency冲突,但是从长远来看,这应该使您不太可能因软件包的依赖关系而陷入困境。

http://blog.npmjs.org/post/110924823920/npm-weekly-5 http://blog.npmjs.org/post/110924823920/npm-weekly-5

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

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