How to fix npm ERR! code EABORT npm ERR! Aborted in npm

npmBEGINNERMEDIUMUpdated Dec 5, 2025· 175 views

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
  1. Clean up and verify current state
  2. Increase Node.js memory allocation
  3. Update npm and Node.js
  4. Use npm ci for consistency
npm — error
# 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
npm ERR! code EABORT
npm 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

  1. Insufficient Memory/Heap Space—Node.js process exceeds its default 1.7 GB memory limit during dependency resolution
  2. Container/Kubernetes Termination—Docker or Kubernetes sends SIGTERM signal, interrupting npm mid-operation
  3. Outdated npm or Node.js Version—older versions have bugs and inefficient dependency resolution algorithms
  4. Corrupted Cache or Lock Files—npm cache becomes corrupted or lock files prevent proper operation
  5. System Resource Exhaustion—low disk space, low RAM, or constrained VM memory allocation
  6. Network Interruption During Install—connection drops while npm is downloading packages

How to fix "npm ERR! code EABORT npm ERR! Aborted"

1Clean up and verify current state

First, clear out any partially installed or corrupted files:

bash
# 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

After cleaning, verify your npm configuration is valid:

bash
npm config list
2Increase Node.js memory allocation

The most common cause is npm's dependency resolver exceeding the default 1.7 GB memory limit. Increase available memory:

bash
# Linux/macOS - set environment variable
export NODE_OPTIONS="--max-old-space-size=4096"

# Then run npm install
npm install

Or run a single command:

bash
# 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 install

For Docker environments, add to your Dockerfile:

dockerfile
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN npm install
3Update npm and Node.js

Older versions have bugs in dependency resolution and poor signal handling:

bash
# Check current versions
npm --version
node --version

# Update npm globally to latest version
npm install -g npm@latest

For Node.js, use a version manager:

bash
# Using nvm
nvm install --lts
nvm use --lts

Node.js v18 LTS or newer with npm v9+ significantly improved memory efficiency.

4Use npm ci for consistency

If you have a working package-lock.json, use npm ci (clean install) instead of npm install:

bash
npm ci

npm 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.

5Retry installation with monitoring

Attempt the install while monitoring system resources:

bash
# Increase memory and install
NODE_OPTIONS="--max-old-space-size=4096" npm install

On macOS/Linux, monitor memory usage in another terminal:

bash
# Monitor every 2 seconds
watch -n 2 'free -h'

# Or use top command
top -o %MEM

If 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:

yaml
services:
  app:
    environment:
      NODE_OPTIONS: "--max-old-space-size=4096"
    deploy:
      resources:
        limits:
          memory: 4G

npm 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