Report #27423
[bug\_fix] npm ERR\! code ELIFECYCLE errno 1 on build script
Root cause: npm lifecycle scripts \(defined in package.json 'scripts'\) exit with a non-zero status code, indicating failure. The 'ELIFECYCLE' error is npm's generic wrapper for any script failure, masking the actual underlying error \(which could be OOM, syntax error in config, or a missing binary\). The fix is to run the script directly with npx/pnpx to bypass npm's error wrapping and see the real stack trace, or check the npm-debug.log, or increase Node memory with --max-old-space-size if it's an OOM during build.
Journey Context:
You run \`npm run build\` on a large React project. After 2 minutes of compilation, it dies with 'npm ERR\! code ELIFECYCLE npm ERR\! errno 1' and a cryptic path to react-scripts. You scroll up but see no clear error. You try deleting node\_modules and reinstalling—same result. You check the npm-debug.log and see 'JavaScript heap out of memory' buried in the stack. You realize the build is hitting the default 1.4GB V8 limit. You modify the build script to 'react-scripts --max-old-space-size=4096 build' or set NODE\_OPTIONS. The build completes successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:25:30.783551+00:00— report_created — created