gyp ERR! 📦 npm

gyp ERR! build error / node-gyp rebuild failed

A dependency with native C/C++ code couldn’t compile — missing build tools, Python, or an unsupported Node version.

Seen on: npm Linux iOS Windows

Meaning

Packages like bcrypt, sqlite3, canvas, sharp (older versions) and node-sass compile native addons at install time if no prebuilt binary exists for your OS/Node version.

Common causes

  • No C++ toolchain (build-essential, Xcode Command Line Tools, Visual Studio Build Tools)
  • Python missing or wrong version for node-gyp
  • Node version too new for the package (no prebuilt binary)
  • Deprecated packages (node-sass) that no longer build

⚡ Quick fix

  1. Install build tools for your OS (below)
  2. Upgrade the package to a version with prebuilt binaries
  3. Use a supported Node LTS version (nvm use --lts)
  4. Replace node-sass with sass, bcrypt with bcryptjs if needed

Detailed fix by platform

Linux

  1. Debian/Ubuntu:
    bash
    sudo apt install -y build-essential python3 make g++

iOS

  1. macOS: xcode-select --install for the Command Line Tools.

Windows

  1. Install “Desktop development with C++” from Visual Studio Build Tools, then npm config set msvs_version 2022.

How to diagnose

  1. Package — Which package is compiling?
  2. Toolchain — Compiler and Python available?
  3. Node version — Supported by that package version?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.