Introducing Livops 2.0! Promo codeCEOgives you 8,000 so‘m on your balance.What’s new

gyp ERR! build error / gyp ERR! find Python: node-gyp rebuild failed during npm install, how to fix it

gyp ERR! build error, gyp ERR! find Python or gyp ERR! stack Error: not found: make means npm install tried to compile a native addon such as bcrypt, sqlite3 or sharp, and the machine has no Python, make or C++ compiler. It usually happens because no prebuilt binary fits your Node version or platform (Alpine/musl included). Upgrade to a release with prebuilt binaries, switch to a pure-JavaScript package such as bcryptjs, or install the build tools.

By Livops team, the people who build and run LivopsUpdated

As it appears in a deploy log (shortened; example-addon stands for the package being compiled). Current npm prints the script’s output under its own npm error lines[9][10], so every gyp ERR! line starts with npm error:

npm error code 1
npm error path /app/node_modules/example-addon
npm error command failed
npm error command sh -c node-gyp rebuild
npm error gyp ERR! find Python
npm error gyp ERR! find Python --python was not set on the command line
npm error gyp ERR! find Python Python is not set from environment variable PYTHON
npm error gyp ERR! find Python checking if "python3" can be used
npm error gyp ERR! find Python - "python3" is not in PATH or produced an error
npm error gyp ERR! find Python checking if "python" can be used
npm error gyp ERR! find Python - "python" is not in PATH or produced an error
npm error gyp ERR! find Python You need to install the latest version of Python.
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: Could not find any Python installation to use
npm error gyp ERR! not ok

With Python present but no build tools, the same block ends like this instead (shortened)[3][5][7]:

npm error gyp ERR! build error
npm error gyp ERR! stack Error: not found: make
npm error gyp ERR! System Linux 6.8.0
npm error gyp ERR! node -v v24.11.0
npm error gyp ERR! not ok

This page explains what node-gyp does during npm install, the four causes in the order they usually happen, and the fix for each, starting with the ones that need no compiler at all.

What does the error mean?

npm is compiling a native addon

node-gyp is the tool that compiles native addons, Node.js packages with C or C++ code in them[1]. When a package has a binding.gyp file and no install or preinstall script of its own, npm makes its install step node-gyp rebuild[8]. rebuild runs three commands in a row: clean, configure and build[4]. Each failure names its step:

  • gyp ERR! configure error with find Python lines above it: configure needs Python and found none. node-gyp checks the --python option, the PYTHON variable, then python3 and python on the PATH, and stops with Could not find any Python installation to use[2]. It needs Python 3.6 or newer[2].
  • gyp ERR! build error with not found: make: build runs make on Linux and macOS, and looks it up on the PATH first[3]; not found: make is the lookup failing[7].
  • gyp ERR! build error with `make` failed with exit code : make ran, but the compile itself failed[3]. The compiler’s own error is in the lines above, often a missing g++ or a missing system library.

Every gyp line starts with gyp and the level, ERR! for errors, then the step’s own prefix such as find Python[6]. After the error, node-gyp prints the system, the Node version and its own version, then not ok[5]. Those lines are worth reading: an unexpected node -v is cause 3 below.

Why it happens on a server and not on your laptop

Most native packages do not expect you to compile them. They ship prebuilt binaries for common platforms and compile only when none fits: sqlite3 downloads a prebuilt binary for your platform if one exists, and otherwise builds with node-gyp, which needs a C++ compiler and linker[15]. bcrypt publishes prebuilt binaries for Windows, Linux (glibc and musl) and macOS, on x64 and arm64[13]. So a compile, and with it this error, usually means no prebuilt binary matched, and the machine has no build tools to fall back on.

Causes, most common first

1. No prebuilt binary for your Node version

Prebuilt binaries are made for the Node versions that existed when the package was released. bcrypt’s README says its binaries are best-effort, that there may be an interval between a release and its compiled modules, and that Node 18 onwards needs bcrypt 6.0.0 or later[13]. An old version of a native package on a new Node compiles from source.

Fix: upgrade the package to a current release, which has binaries for current Node versions:

npm install bcrypt@latest
npm ls bcrypt          # check which version is actually installed

Packages built on Node-API need no binary per Node version: sqlite3 5 and later work this way, and its prebuilt binaries should work on Node 20.17.0 and later[15]. If you cannot upgrade the package yet, pin a Node version it has binaries for, for example in .nvmrc.

2. A package that never needed compiling: switch to a pure-JavaScript one

Where a pure-JavaScript package does the same job, there is nothing to compile on any machine:

  • bcrypt → bcryptjs. bcrypt.js is bcrypt in JavaScript with zero dependencies, compatible with the C++ bcrypt binding; it is slower, about 30% by its own benchmark[14]. It has the same hash and compare calls[14]:

    npm uninstall bcrypt
    npm install bcryptjs
    import bcrypt from "bcryptjs";
    const hash = await bcrypt.hash(password, 10);
    const ok = await bcrypt.compare(password, hash);
  • sqlite3. Its repository now says it is unmaintained[15]. Node itself has a built-in node:sqlite module, added in 22.5.0 and usable without a flag from 22.13.0, though still marked experimental there[16]. Check its stability in the Node docs before moving production code to it.

  • sharp. Current sharp ships ready-compiled sharp and libvips binaries for the common platforms, Linux x64 and ARM64 with glibc or musl among them, and needs a Node-API v9 runtime such as Node 20.9.0 or later[17]. Building it from source is a separate step in its docs, npm explore sharp -- npm run build[17]. If its install still fails, its docs ask that your package manager installs optional dependencies, and warn that a package-lock.json shared between platforms can cause installation problems[17].

3. No Python

The machine has no Python 3, or node-gyp cannot find it. Fix: install it, or point node-gyp at it[1][2]:

# Debian or Ubuntu
apt-get update && apt-get install -y python3
# Alpine
apk add --no-cache python3
# or tell node-gyp where it is
PYTHON=/usr/bin/python3 npm install

node-gyp run by hand also takes --python /path/to/python, and NODE_GYP_FORCE_PYTHON overrides every other setting[1].

Python 3.12 and later need node-gyp 10 or newer[1]. npm bundles node-gyp 10 from npm 10.3.0[11], so with an older npm and a new Python, update npm (npm install -g npm@latest).

4. No make or C++ compiler (and Alpine)

Python was found, but make or the compiler was not. node-gyp needs, on Unix, Python, make and a C/C++ toolchain such as GCC; on macOS, the Xcode Command Line Tools (xcode-select --install), which bring clang, clang++ and make[1]. On Windows it needs Python and the Visual Studio C++ build tools, for example choco install python visualstudio2026-workload-vctools -y[1].

Slim and Alpine images are where this happens most. node:slim contains only the minimal packages needed to run node[18]. node:alpine uses musl instead of glibc, and applications built for Debian (glibc) generally do not run on it[18], so a binary must be built for musl. Based on the multistage example in the Node.js Docker images’ best practices[19]:

FROM node:22-alpine AS builder
WORKDIR /app
RUN apk add --no-cache python3 make g++
COPY package.json package-lock.json ./
RUN npm ci
COPY . .

FROM node:22-alpine
WORKDIR /app
COPY --from=builder /app ./
CMD ["node", "server.js"]

The compilers stay in the first stage, and the compiled node_modules is copied into the image that runs[19]. Build and run on the same base (both Alpine here), so the binary matches the C library. On Debian-based images the equivalent is apt-get install -y python3 make g++.

How to confirm the fix locally

See the full compiler output, not only the summary. --foreground-scripts runs install scripts in the foreground, sharing their output with npm’s[12]:

rm -rf node_modules
npm ci --foreground-scripts

To reproduce the server, run the install in a container with the same Node version and base. A slim image has no compiler, so it shows whether your dependencies still need one:

docker run --rm -v "$PWD":/app -w /app node:22-slim npm ci

If it passes there, no package compiled, or it compiled with what the image has.

On Livops

  • Where it shows. A failed install stops the deploy as install_failed, with the error in the build log; the previous version keeps running. See Install failed.
  • A Tip line for gyp ERR! find Python. The log ends with a Tip: line for this case. Packages like bcrypt or an old sqlite3 compile C code: switch to a prebuilt one, bcryptjs instead of bcrypt, or otherwise add a Dockerfile to the project.
  • Node 22 or 24. Those are the Node versions Livops has, so pick package versions with binaries for them. Livops reads .nvmrc and .node-version; set devEngines.runtime.version in package.json to 22 or 24 if you use it.
  • Your own Dockerfile. If the repository has a Dockerfile, it is used, and the build tools are whatever it installs, as in the example above. When Livops also recognises a framework in the project, builder in livops.json (dockerfile or preset) decides which one builds it; it is read when the project is created. See Frameworks and livops.json.
  • The assistant explains. Next to the failed build, the assistant’s button reads the log and tells you what happened and how to fix it. See AI assistant.

If the install stops earlier, on a peer dependency conflict, see npm ERR! code ERESOLVE; for other failures that end in code 1, see npm error code 1.

Questions

What is node-gyp and why does npm install run it?

node-gyp compiles native addons, packages written partly in C or C++. When a package has a binding.gyp file and no install script of its own, npm runs node-gyp rebuild for it during the install. Many native packages first try to use a prebuilt binary and call node-gyp only when none fits.

What does gyp ERR! find Python mean?

node-gyp looked for Python, which it needs to generate the build files, and found none it could use. It checks the --python option, the PYTHON variable, then python3 and python on the PATH. Install Python 3, or point node-gyp to it with the PYTHON environment variable.

What does gyp ERR! stack Error not found make mean?

Python was found and the build files were generated, but the make command is not on the PATH. On Linux, node-gyp needs make and a C and C++ compiler such as GCC. Install them, for example python3, make and g++, or avoid the compile with a package that ships a prebuilt binary.

Can I use bcryptjs instead of bcrypt?

Yes, in most apps. bcryptjs is pure JavaScript with zero dependencies, its README says it is compatible with the C++ bcrypt binding, and it never compiles anything. It is slower, about 30 percent by its own benchmark, which matters only for very high login volumes.

Why does it compile on the server but not on my laptop?

Prebuilt binaries are chosen by platform, CPU, C library and Node version. Your laptop may match a binary the package ships while the server, for example Linux on Alpine with musl, or a newer Node, does not. Then the package falls back to compiling, and the server has no compiler.

Does Python 3.12 break node-gyp?

Old versions of it. The node-gyp README says Python 3.12 and later need node-gyp 10 or newer. npm bundles node-gyp 10 or newer from npm 10.3.0, so updating npm is the fix.

Sources

  1. node-gyp — README (github.com). Checked .
  2. node-gyp source — lib/find-python.js (github.com). Checked .
  3. node-gyp source — lib/build.js (github.com). Checked .
  4. node-gyp source — lib/rebuild.js (github.com). Checked .
  5. node-gyp source — bin/node-gyp.js (github.com). Checked .
  6. node-gyp source — lib/log.js (github.com). Checked .
  7. which (npm) source — lib/index.js (github.com). Checked .
  8. npm Docs — scripts (docs.npmjs.com). Checked .
  9. npm source — lib/utils/error-message.js (github.com). Checked .
  10. @npmcli/promise-spawn source — lib/index.js (github.com). Checked .
  11. npm 10.3.0 source — package.json (bundled node-gyp) (raw.githubusercontent.com). Checked .
  12. npm Docs — config (foreground-scripts) (docs.npmjs.com). Checked .
  13. bcrypt (node.bcrypt.js) — README (github.com). Checked .
  14. bcrypt.js (bcryptjs) — README (github.com). Checked .
  15. node-sqlite3 — README (github.com). Checked .
  16. Node.js Docs — SQLite (node:sqlite) (nodejs.org). Checked .
  17. sharp — Installation (sharp.pixelplumbing.com). Checked .
  18. Node.js Docker images — README (github.com). Checked .
  19. Node.js Docker images — Best Practices (node-gyp alpine) (github.com). Checked .

Put your project online today

Connect GitHub or drop a folder. No card is asked for.

Deploy your Node app

Got a question? — @livops_uz