How to fix npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134 in npm
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- Increase Node.js heap size
- Add memory flag to package.json scripts
- Clean install dependencies
- Verify 64-bit Node.js is installed
# Linux/macOSexport NODE_OPTIONS="--max-old-space-size=4096"npm run build# Windows Command Promptset NODE_OPTIONS=--max-old-space-size=4096npm run build# Windows PowerShell$env:NODE_OPTIONS="--max-old-space-size=4096"npm run buildnpm ERR! code ELIFECYCLEnpm ERR! errno 134npm 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
- 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
- Native module compilation failures triggering abort
- Large monorepo dependency resolution exhausting memory
- Webpack/bundler optimization phase consuming excessive memory
How to fix "npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! Exit status 134"
The primary fix—allocate more memory to Node.js:
# 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 buildCommon values: 4096 (4GB), 8192 (8GB). Don't exceed your system RAM.
Make the fix permanent in your project:
{
"scripts": {
"build": "node --max-old-space-size=4096 node_modules/.bin/webpack",
"build:prod": "NODE_OPTIONS=--max-old-space-size=4096 react-scripts build"
}
}Reset npm state before retrying:
# Delete existing artifacts
rm -rf node_modules package-lock.json
# Clear npm cache
npm cache clean --force
# Use npm ci for cleaner install
npm ci32-bit Node.js has lower memory limits:
# 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=nodeIf running in Docker, allocate more memory:
# Run container with 4GB memory
docker run --memory=4g myimage
# In docker-compose.yml
services:
app:
mem_limit: 4gAlso increase Docker Desktop's VM memory in Settings → Resources.
On Linux, insufficient file watchers can cause related issues:
# 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 -pAdvanced 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:
npm uninstall node-sass
npm install sassFor 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
- 📚npm Official Documentation
- 💬Stack Overflow: error code elifecycle npm err errno 134(Stack Overflow)
- 🐙GitHub #5880: npm/cli(GitHub)
- 🐙GitHub #2641: sass/node-sass(GitHub)