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 ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error