The ELIFECYCLE exit code 1 error indicates a npm script failed with an error. The actual error is typically shown before this message and relates to your script's code, not npm itself.
ELIFECYCLE occurs when a script in your package.json exits with a non-zero status. Exit code 1 is the general error code indicating something went wrong. npm is just reporting that your script failed - the actual problem is in your code or its dependencies. npm wraps all script execution and reports ELIFECYCLE when any script fails, regardless of the actual cause.
Look ABOVE the ELIFECYCLE message:
# Error output is before this:
# npm ERR! code ELIFECYCLE
# The real error might be:
# SyntaxError: Unexpected token
# Error: Cannot find module
# Test failed: expected X got YTest outside npm:
# See what the script runs
cat package.json | jq '.scripts.build'
# Run it directly
node build.js
# or
webpack --config webpack.config.jsEnsure all deps installed:
rm -rf node_modules
npm install
npm run your-scriptCheck required env vars:
# List required env vars from docs/code
env | grep -E "NODE_|API_|DB_"
# Set if missing
export NODE_ENV=developmentGet more information:
# Run with verbose
npm run build --verbose
# Or add to script
"build": "DEBUG=* node build.js"Address the specific issue:
- Syntax errors: check affected file
- Module not found: install missing package
- Test failures: fix failing tests
- Build errors: fix compilation issues
ELIFECYCLE is not the error itself - it's npm reporting that a script failed. Always look at the output before this message. In CI/CD, capture the full output to see the real error. Some tools have specific debug flags (DEBUG=*, --verbose, -v). Exit code 1 is generic; other codes may indicate specific problems.
npm notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm