Woah, npm 7 automatically installs peer dependencies:...


Woah, npm 7 automatically installs peer dependencies: https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/

This will bite people.

Example: If a package specifies React 16 as a peerDependency, it won't install if you're using React 17!

Workaround: disable auto install via this flag:
--legacy-peer-deps 😎

Takeaway: If you're maintaining an npm package, avoid declaring restrictive peerDependencies versions. If you specify a specific max version, you need to immediately update your peerDependencies when new major versions are released. Otherwise, your consumers will get an error.

View original on X