How to fix npm ERR! code EABORT npm ERR! Aborted in npm
The EABORT error occurs when npm abruptly terminates, typically due to memory exhaustion, process signals, or container termination. The fix usually involves increasing memory allocation or clearing corrupted cache.
Quick fix
Fixes npm ERR! code EABORT npm ERR! Aborted
# Remove node_modules directory completely
rm -rf node_modules
# Remove package-lock.json to force fresh resolution
rm package-lock.json
# Clear npm cache to remove any corrupted cached packages
npm cache clean --force- Clean up and verify current state
- Increase Node.js memory allocation
- Update npm and Node.js
- Use npm ci for consistency
# Remove node_modules directory completelyrm -rf node_modules# Remove package-lock.json to force fresh resolutionrm package-lock.json# Clear npm cache to remove any corrupted cached packagesnpm cache clean --forcenpm ERR! code EABORTnpm ERR! Aborted
What this error means
The "npm ERR! code EABORT" error occurs when npm abruptly terminates its execution, typically due to a process being interrupted or encountering a fatal condition that forces shutdown. Unlike other npm errors that provide specific failure reasons, EABORT is a generic abort signal indicating the npm process received a termination request or ran out of critical resources (like memory). This can happen during npm install, npm update, or any npm operation, and often leaves the installation in an incomplete state. The error can originate from several sources: the operating system terminating the process due to resource exhaustion, external signals (SIGTERM, SIGKILL) from container orchestration systems, hardware constraints in virtual environments, or npm's dependency resolution algorithm consuming excessive memory. Because the process is forcibly stopped rather than cleanly exiting, you may see partial node_modules directories and corrupted lock files left behind.
Typical symptoms
- npm install or npm update commands terminate abruptly with 'npm ERR! Aborted' message
- No clear error message explaining the cause, just an abort signal
- node_modules directory partially created or corrupted, requiring cleanup
- package-lock.json file is missing or incomplete
- Running npm commands on containers or low-memory systems fails consistently
- Process manager logs show 'signal SIGTERM' or 'killed' messages
Common causes
- Insufficient Memory/Heap Space—Node.js process exceeds its default 1.7 GB memory limit during dependency resolution
- Container/Kubernetes Termination—Docker or Kubernetes sends SIGTERM signal, interrupting npm mid-operation
- Outdated npm or Node.js Version—older versions have bugs and inefficient dependency resolution algorithms
- Corrupted Cache or Lock Files—npm cache becomes corrupted or lock files prevent proper operation
- System Resource Exhaustion—low disk space, low RAM, or constrained VM memory allocation
- Network Interruption During Install—connection drops while npm is downloading packages
How to fix "npm ERR! code EABORT npm ERR! Aborted"
First, clear out any partially installed or corrupted files:
# Remove node_modules directory completely
rm -rf node_modules
# Remove package-lock.json to force fresh resolution
rm package-lock.json
# Clear npm cache to remove any corrupted cached packages
npm cache clean --forceAfter cleaning, verify your npm configuration is valid:
npm config listThe most common cause is npm's dependency resolver exceeding the default 1.7 GB memory limit. Increase available memory:
# Linux/macOS - set environment variable
export NODE_OPTIONS="--max-old-space-size=4096"
# Then run npm install
npm installOr run a single command:
# Linux/macOS
NODE_OPTIONS="--max-old-space-size=4096" npm install
# Windows PowerShell
$env:NODE_OPTIONS="--max-old-space-size=4096"; npm install
# Windows Command Prompt
set NODE_OPTIONS=--max-old-space-size=4096 && npm installFor Docker environments, add to your Dockerfile:
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN npm installOlder versions have bugs in dependency resolution and poor signal handling:
# Check current versions
npm --version
node --version
# Update npm globally to latest version
npm install -g npm@latestFor Node.js, use a version manager:
# Using nvm
nvm install --lts
nvm use --ltsNode.js v18 LTS or newer with npm v9+ significantly improved memory efficiency.
If you have a working package-lock.json, use npm ci (clean install) instead of npm install:
npm cinpm ci is more deterministic and faster, as it skips dependency resolution and uses exact versions from the lock file. This avoids the memory-heavy dependency resolver.
Attempt the install while monitoring system resources:
# Increase memory and install
NODE_OPTIONS="--max-old-space-size=4096" npm installOn macOS/Linux, monitor memory usage in another terminal:
# Monitor every 2 seconds
watch -n 2 'free -h'
# Or use top command
top -o %MEMIf memory usage approaches your limit, terminate and increase the --max-old-space-size value further.
Advanced notes
Docker and Container Considerations: If running in Docker, the EABORT error often occurs because the container's memory limit is too low for npm's workload. Increase the limit in docker-compose.yml:
services:
app:
environment:
NODE_OPTIONS: "--max-old-space-size=4096"
deploy:
resources:
limits:
memory: 4Gnpm 10.4.0+ Bug: Versions npm 10.4.0 to 10.7.x have a known issue where dependency resolution consumes excessive memory, especially without a package-lock.json. Update to npm 10.8.0+ or use npm 9.x LTS as a workaround.
Kubernetes/Orchestration: If running in Kubernetes, EABORT often indicates the pod's readiness/liveness probes are too aggressive. Increase the initialDelaySeconds and timeoutSeconds.
Permanent Environment Configuration: Create a .npmrc file in your project root to persist the memory setting: node-options=--max-old-space-size=4096
Frequently asked questions
- What does "npm ERR! code EABORT npm ERR! Aborted" mean?
- The "npm ERR! code EABORT" error occurs when npm abruptly terminates its execution, typically due to a process being interrupted or encountering a fatal condition that forces shutdown. Unlike other npm errors that provide specific failure reasons, EABORT is a generic abort signal indicating the npm process received a termination request or ran out of critical resources (like memory).
- How do I fix "npm ERR! code EABORT npm ERR! Aborted"?
- The EABORT error occurs when npm abruptly terminates, typically due to memory exhaustion, process signals, or container termination. The fix usually involves increasing memory allocation or clearing corrupted cache.
- What causes "npm ERR! code EABORT npm ERR! Aborted"?
- Insufficient Memory/Heap Space—Node.js process exceeds its default 1.7 GB memory limit during dependency resolution Container/Kubernetes Termination—Docker or Kubernetes sends SIGTERM signal, interrupting npm mid-operation Outdated npm or Node.js Version—older versions have bugs and inefficient dependency resolution algorithms
- Is the "npm ERR! code EABORT npm ERR! Aborted" 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
- 📖npm docs: npm install(Official Docs)
- 🐙GitHub: npm EABORT issues(GitHub)
- 💬Stack Overflow: EABORT npm(Stack Overflow)