npm ERR! code ELIFECYCLE — how to fix
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@1.0.0 start script.
Quick fix: Scroll up: the real error is in the output before the npm ERR! lines. Fix that. If it's a dependency problem, try rm -rf node_modules package-lock.json && npm install.
What it means
npm ran one of your package.json scripts (here start) and the command exited with a non-zero code. npm just reports that. Newer npm versions print npm ERR! Lifecycle script "start" failed or npm error code 1 for the same thing.
Step 1: find the real error
Look at the lines above the npm ERR! block. Common ones:
Error: Cannot find module ...→ see Cannot find moduleEADDRINUSE→ see address already in useSyntaxError ...→ a bug in your code or an unsupported Node versionsh: 1: react-scripts: not found→ dependencies not installed:npm installJavaScript heap out of memory→NODE_OPTIONS=--max-old-space-size=4096 npm run build
Step 2: run the command directly
Copy the command shown after the script name and run it yourself, e.g.:
node server.js
npx react-scripts build
The output is often clearer without npm in between.
Step 3: reinstall dependencies
rm -rf node_modules package-lock.json
npm cache verify
npm install
Keep package-lock.json if your team relies on it; then just delete node_modules and run npm ci.
Step 4: check the Node version
Many projects specify one in package.json ("engines") or .nvmrc. Check node -v and switch with nvm use if needed.
Last updated 2026-10-27.