How to fix npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install in npm

npmINTERMEDIATEMEDIUMUpdated Dec 6, 2025· 132 views

The prebuild-install ELIFECYCLE error occurs when npm fails to download prebuilt binaries and then fails to compile from source. Install build tools (Python, C++ compiler) to enable fallback compilation.

Quick fix

Fixes npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install

xcode-select --install
  1. Install build tools for your platform
  2. Clean cache and reinstall
  3. Check Node.js version compatibility
  4. Force rebuild from source
npm — error
xcode-select --install
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! prebuild-install

What this error means

The prebuild-install error occurs during installation of native Node.js modules that contain C++ code. These packages use a two-step installation process: first, prebuild-install attempts to download precompiled binaries for your platform; if that fails, it falls back to compiling from source using node-gyp. When you see this error, it means both steps failed—no prebuilt binary was available for your platform/Node version combination, and the source compilation also failed due to missing build tools (Python, C++ compiler, make) or other compilation errors.

Typical symptoms

  • npm install fails with "prebuild-install" in error message
  • Error shows "No prebuilt binaries found" followed by compilation failure
  • Installation halts on packages like sharp, bcrypt, canvas, or leveldown
  • gyp ERR! messages appear before ELIFECYCLE
  • Works on some machines but fails on others
  • CI/CD pipelines fail during dependency installation

Common causes

  1. Missing build tools (Python, C++ compiler, make)
  2. No prebuilt binary available for your Node.js version
  3. No prebuilt binary available for your platform/architecture
  4. Insufficient memory for compilation (Docker/containers)
  5. Corrupted npm cache
  6. Windows SDK version mismatch
  7. Xcode Command Line Tools not installed (macOS)

How to fix "npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install"

1Install build tools for your platform

Native modules need compilation tools when prebuilt binaries aren't available:

macOS:

bash
xcode-select --install

Ubuntu/Debian:

bash
sudo apt-get update
sudo apt-get install build-essential python3

Windows:

bash
# Run as Administrator
npm install -g windows-build-tools

# Or install Visual Studio Build Tools manually

Alpine Linux (Docker):

dockerfile
RUN apk add --no-cache python3 make g++ gcc
2Clean cache and reinstall

Reset npm state and try again:

bash
# Clear npm cache
npm cache clean --force

# Remove existing installation
rm -rf node_modules package-lock.json

# Reinstall
npm install
3Check Node.js version compatibility

Prebuilt binaries may not exist for very new Node.js versions:

bash
# Check your version
node -v

# Try an LTS version if on bleeding edge
nvm install --lts
nvm use --lts

# Reinstall packages
rm -rf node_modules && npm install
4Force rebuild from source

Explicitly rebuild native modules:

bash
# Rebuild all native modules
npm rebuild

# Rebuild specific package from source
npm rebuild sharp --build-from-source
npm rebuild bcrypt --build-from-source
5Set Python path for node-gyp

If Python isn't found automatically:

bash
# Set Python path globally
npm config set python /usr/bin/python3

# Or set environment variable
export npm_config_python=/usr/bin/python3
npm install
6Increase memory for Docker builds

Compilation can fail with insufficient memory:

bash
# Increase Docker memory to 4GB+
# Docker Desktop: Settings → Resources → Memory

# Or run with memory flag
docker run --memory=4g ...

Advanced notes

Common packages that use prebuild-install: sharp (image processing), bcrypt (password hashing), canvas, leveldown, sqlite3, and serialport.

For production, consider pure JavaScript alternatives that don't require native compilation:
- bcrypt → bcryptjs
- node-sass → sass (Dart Sass)
- sharp → jimp (slower but pure JS)

Modern packages are migrating to prebuildify + node-gyp-build, which ships all binaries inside the npm package, eliminating the download step entirely. Packages using this approach are more reliable across platforms.

Frequently asked questions

What does "npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install" mean?
js modules that contain C++ code. These packages use a two-step installation process: first, prebuild-install attempts to download precompiled binaries for your platform; if that fails, it falls back to compiling from source using node-gyp. When you see this error, it means both steps failed—no prebuilt binary was available for your platform/Node version combination, and the source compilation also failed due to missing build tools (Python, C++ compiler, make) or other compilation errors.
How do I fix "npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install"?
The prebuild-install ELIFECYCLE error occurs when npm fails to download prebuilt binaries and then fails to compile from source. Install build tools (Python, C++ compiler) to enable fallback compilation.
What causes "npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install"?
Missing build tools (Python, C++ compiler, make) No prebuilt binary available for your Node.js version No prebuilt binary available for your platform/architecture
Is the "npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! prebuild-install" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading