How to fix npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134 in npm

npmINTERMEDIATEMEDIUMUpdated Dec 6, 2025· 151 views

Exit code 134 indicates SIGABRT (abort signal), typically caused by JavaScript heap out of memory during npm install or build. Increase Node.js memory allocation to resolve this.

Quick fix

Fixes npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134

# Linux/macOS
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build

# Windows Command Prompt
set NODE_OPTIONS=--max-old-space-size=4096
npm run build

# Windows PowerShell
$env:NODE_OPTIONS="--max-old-space-size=4096"
npm run build
  1. Increase Node.js heap size
  2. Add memory flag to package.json scripts
  3. Clean install dependencies
  4. Verify 64-bit Node.js is installed
npm — error
# Linux/macOS
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build
# Windows Command Prompt
set NODE_OPTIONS=--max-old-space-size=4096
npm run build
# Windows PowerShell
$env:NODE_OPTIONS="--max-old-space-size=4096"
npm run build
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Exit status 134

What this error means

Exit code 134 is calculated as 128 + 6, where 6 is the SIGABRT (abort) signal number. This error occurs when the Node.js process terminates abnormally, almost always due to running out of memory. The most common scenario is the "JavaScript heap out of memory" error during large builds, dependency installations in monorepos, or webpack compilations. The Node.js process exhausts its allocated memory and aborts. You'll often see "FATAL ERROR: Reached heap limit Allocation failed" in the output before the ELIFECYCLE message.

Typical symptoms

  • npm install aborts during large dependency installation
  • Build process fails with "JavaScript heap out of memory"
  • Angular/React/webpack builds crash mid-compilation
  • Error appears intermittently (sometimes succeeds, sometimes fails)
  • Particularly common in Docker containers and CI environments
  • WSL environments with node-sass frequently affected

Common causes

  1. JavaScript heap memory limit exceeded during build
  2. Insufficient system RAM or Docker memory allocation
  3. Node.js 32-bit version has lower memory limits than 64-bit
  4. Native module compilation failures triggering abort
  5. Large monorepo dependency resolution exhausting memory
  6. Webpack/bundler optimization phase consuming excessive memory

How to fix "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134"

1Increase Node.js heap size

The primary fix—allocate more memory to Node.js:

bash
# Linux/macOS
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build

# Windows Command Prompt
set NODE_OPTIONS=--max-old-space-size=4096
npm run build

# Windows PowerShell
$env:NODE_OPTIONS="--max-old-space-size=4096"
npm run build

Common values: 4096 (4GB), 8192 (8GB). Don't exceed your system RAM.

2Add memory flag to package.json scripts

Make the fix permanent in your project:

json
{
  "scripts": {
    "build": "node --max-old-space-size=4096 node_modules/.bin/webpack",
    "build:prod": "NODE_OPTIONS=--max-old-space-size=4096 react-scripts build"
  }
}
3Clean install dependencies

Reset npm state before retrying:

bash
# Delete existing artifacts
rm -rf node_modules package-lock.json

# Clear npm cache
npm cache clean --force

# Use npm ci for cleaner install
npm ci
4Verify 64-bit Node.js is installed

32-bit Node.js has lower memory limits:

bash
# Check Node.js architecture
node -p "process.arch"

# Should output: x64
# If it shows x86 or ia32, reinstall 64-bit version

# On Windows, download x64 installer from nodejs.org
# On Linux/macOS with nvm:
nvm install node --reinstall-packages-from=node
5Increase Docker container memory

If running in Docker, allocate more memory:

bash
# Run container with 4GB memory
docker run --memory=4g myimage

# In docker-compose.yml
services:
  app:
    mem_limit: 4g

Also increase Docker Desktop's VM memory in Settings → Resources.

6Increase Linux file watcher limits

On Linux, insufficient file watchers can cause related issues:

bash
# Check current limit
cat /proc/sys/fs/inotify/max_user_watches

# Increase temporarily
echo 65536 | sudo tee /proc/sys/fs/inotify/max_user_watches

# Make permanent
echo "fs.inotify.max_user_watches=65536" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Advanced notes

For CI/CD pipelines with memory constraints, consider splitting builds or using incremental compilation. Webpack's cache option and Next.js's incremental builds reduce memory usage.

If using node-sass (deprecated), migrate to Dart Sass which doesn't have the same native compilation memory issues:

bash
npm uninstall node-sass
npm install sass

For Angular projects, the Angular CLI has its own memory management. Use the --configuration=production flag which enables ahead-of-time compilation and may use memory more efficiently.

Frequently asked questions

What does "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134" mean?
Exit code 134 is calculated as 128 + 6, where 6 is the SIGABRT (abort) signal number. js process terminates abnormally, almost always due to running out of memory. The most common scenario is the "JavaScript heap out of memory" error during large builds, dependency installations in monorepos, or webpack compilations.
How do I fix "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134"?
Exit code 134 indicates SIGABRT (abort signal), typically caused by JavaScript heap out of memory during npm install or build. Increase Node.js memory allocation to resolve this.
What causes "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134"?
JavaScript heap memory limit exceeded during build Insufficient system RAM or Docker memory allocation Node.js 32-bit version has lower memory limits than 64-bit
Is the "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading