Skip to content
Latchkey

npm "peer dep missing" Warning in CI - Resolve Unmet Peer Dependencies

A "peer dep missing" warning means a package expects another package to be present in your tree, but it is not installed. Older npm warns; the missing peer can still break the build.

What this error means

During install npm prints a requires a peer of ... but none is installed line. A later build or test step then fails with a module-not-found or runtime error from the package whose peer was never satisfied.

npm
npm WARN @acme/charts@2.0.0 requires a peer of d3@^7.0.0
npm WARN but none is installed. You must install peer dependencies yourself.

Common causes

A declared peer dependency was never added to package.json

The package assumes you provide the peer (a framework or plotting library), but it was never listed as a direct dependency.

The installed peer is outside the required range

A peer is present but at an incompatible major, so the requirement is still unmet.

How to fix it

Install the missing peer at a compatible version

  1. Read the warning to find the required peer name and range.
  2. Add it as a direct dependency at a version inside that range.
  3. Reinstall and commit the updated lockfile.
Terminal
npm install d3@^7

How to prevent it

  • Treat peer warnings as build-blockers in CI, audit them with npm ls, and add each required peer explicitly so a fresh clone installs a complete, working tree.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →