Skip to content
Latchkey

npm "warn deprecated" Escalating to a Failed Build - Fix in CI

A npm warn deprecated line is normally harmless noise - but it becomes a real failure when the deprecated package is later removed/unpublished, ships a breaking final release, or a strict CI step is configured to fail on deprecation.

What this error means

Installs print npm warn deprecated <pkg>@<ver>, and then a later step fails - a build error from the deprecated package’s removal, an audit gate, or a policy step that fails the job on deprecated dependencies.

npm output
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated request@2.88.2: request has been deprecated
# later, a strict gate:
Error: dependency 'request' is deprecated and disallowed by policy

Common causes

A deprecated transitive dependency that later breaks

A package warned as deprecated may stop receiving fixes or be unpublished, so a clean install later fails where the warning once passed.

A policy/gate that fails on deprecation

Some pipelines run a check that treats deprecated dependencies as a hard failure, turning the warning into an error.

How to fix it

Replace or override the deprecated dependency

Upgrade the parent that pulls the deprecated package, or override it to a maintained version.

Terminal
npm ls request           # find who depends on it
npm install <parent>@latest   # upgrade to drop the deprecated dep
# or pin a maintained replacement via overrides

Decide how strict to be

  1. Identify which dependency is deprecated and who pulls it.
  2. Upgrade the parent or add an overrides to a maintained version.
  3. If a policy gate is too strict for a still-working transitive dep, scope the rule rather than ignoring all deprecations.

How to prevent it

  • Track deprecation warnings and replace packages before they break.
  • Use overrides to move off deprecated transitive deps.
  • Keep dependency-policy gates scoped and intentional.

Related guides

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