简体   繁体   中英

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. I know that module will work with the newer version. How can I tell npm to ignore the peerinvalid error? Currently the peerinvalid error is stoping the installation process.

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.

This hack will go away if you (or a colleague) need to npm install your package's requirements from scratch. Like I said, a crappy temporary workaround.

In NPM v3 peer dependancies show a warning instead of an error.

We will also be changing the behavior of peerDependencies in npm@3. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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