Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I treat unmet peer dependency as an error in Yarn?

Tags:

yarnpkg

When I run yarn on my project, I get a warning during the linking phase stating:

warning " > [email protected]" has incorrect peer dependency "bar@^2.0.0"

After going through and cleaning these warnings up, I would like to prevent future regressions like this by making these fail the install step in our dev and CI environments. Does yarn provide any mechanism to do this (i.e. CLI arguments or config file changes) or do I need to write something to parse the output?

like image 571
John Koerner Avatar asked Sep 16 '25 01:09

John Koerner


1 Answers

Yarn v2 has logFilters which make it easy to turn a peerDep warning into an error.

There's also this package you can run in CI for yarn v1:

npx check-peer-dependencies
like image 145
Devin Rhode Avatar answered Sep 19 '25 15:09

Devin Rhode