Skip to content
Latchkey

npm ELIFECYCLE / Exit Status Errors - Diagnose Failing npm Scripts

ELIFECYCLE is npm telling you a script exited non-zero. It is a wrapper - the real failure is in the lines above it.

What this error means

An npm run <script> step fails and npm prints ELIFECYCLE with the script name and an exit status. The actual error (a failed test, a compiler error, a missing file) is printed just before the npm summary.

npm output
> my-app@1.0.0 build
> tsc -p tsconfig.json

src/index.ts:12:7 - error TS2322: Type 'string' is not assignable to type 'number'.

npm error code ELIFECYCLE
npm error errno 2

Common causes

The underlying command failed

ELIFECYCLE simply reflects that the command your script ran returned non-zero - a failed build, test, or lint. npm is the messenger, not the cause.

How to fix it

Read above the npm summary

  1. Scroll up from the npm error code ELIFECYCLE block to the real error.
  2. Reproduce the underlying command directly (e.g. run tsc -p tsconfig.json) to iterate faster.
  3. Fix that error; the ELIFECYCLE disappears with it.

How to prevent it

  • Treat ELIFECYCLE as "my script failed", not as an npm bug.
  • Surface the real command’s output clearly in CI logs.

Frequently asked questions

What causes ""npm ERR! code ELIFECYCLE""?
ELIFECYCLE simply reflects that the command your script ran returned non-zero - a failed build, test, or lint. npm is the messenger, not the cause.
How do I fix "npm ERR! code ELIFECYCLE"?
Read above the npm summary

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card