Short answer
Scroll up past the npm lines to the first error the script printed and fix that: a compile error, a failing test, a missing module. The exit code helps: 1 is a normal failure, 127 means the command was not found (run npm install, or the package that provides it is missing), and 137 means the process was killed, most often for running out of memory. During npm install, the failing script belongs to a dependency, so the package name in the message is the one to look at.
What the exit code tells you, and the fix
01
Exit code 1: the script reported an error
“If the script exits with a code other than 0, then this will abort the process.” npm Docs, Scripts: exiting
The build tool, test runner or server failed and printed why before npm took over. Run the script directly to see its output without npm’s summary around it.
# what does the script run? npm pkg get scripts.build # run the same command to see its own error npx vite build02
Exit code 127: command not found
Messages such as sh: react-scripts: command not found or vite: not found mean the tool is not installed in node_modules/.bin. Install dependencies, and check that the tool is listed in package.json (in CI, make sure devDependencies are installed too).
npm ci npm ls vite03
Exit code 137 or SIGKILL: out of memory
The process was killed (some tools print killed with SIGKILL), most often by the operating system or container for using too much memory during a build. A CI timeout or a manual kill gives the same code. Give the build more memory or reduce what runs in parallel.
04
A dependency’s install script failed
During npm install, packages run their own preinstall, install and postinstall scripts, often to compile native code. The message names the package and the script. Upgrade that package, install its build tools, or check its issue tracker for your Node.js version.
Checked against the vendor’s docs on : npm Docs: scripts.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: Vercel “npm run build exited with 1” · Node.js “JavaScript heap out of memory” · npm “EPERM: operation not permitted”