简体   繁体   中英

NPM / Yarn suppress unmet dependencies warning if dependency is globally installed

Whilst installing packages with Yarn I get the following warning

warning Unmet peer dependency "webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc"

Even though I have webpack installed globally.

How do I suppress this warning or do I just have to installed it within the project?

Here is my npm list -g --depth=0 output

npm list -g --depth=0
/usr/local/lib
├── bower@1.8.0
├── browser-sync@2.17.5
├── bufferutil@1.3.0
├── chai@3.5.0
├── create-react-app@1.1.0
├── emoj@0.4.0
├── handlebars@4.0.6
├── hpm-cli@2.0.0
├── http-server@0.9.0
├── jsdoc@3.4.2
├── jshint@2.9.4
├── mocha@3.2.0
├── node-gyp@3.5.0
├── node-inspector@0.12.8
├── nodemon@1.11.0
├── npm@4.4.0
├── snazzy@6.0.0
├── standard@8.6.0
├── webpack@2.2.1
├── webpack-dev-server@2.4.1
└── yarn@0.18.2

Thanks

How do I suppress this warning

Right now there seems to be no way to mute this. There's an open issue on github

or do I just have to install it within the project?

Peer dependencies mean that you need to install it yourself. This is so that the package that you can update your dependency without waiting for the package that uses it to be updated. As an example, webpack-dev-server would depend on a certain version range of webpack , but you can update to a new minor version of webpack (eg a bug fix) without worrying about webpack-dev-server breaking. This way you if some other package depends on a later version of webpack than webpack-dev-server does, you do not end up with 2 conflicting versions of webpack . More info here

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