GrepBoard/Manuals
605 manuals ·

Fix gyp ERR! find Python and Error: not found: make

·Tested on Node.js 22.23.4 · npm 10.9.9 · node-gyp 11.5.0 · Debian 12 (Docker node:22-slim) · 2026-10·Test scope ↓·5 steps

gyp ERR! find Python or Error: not found: make means npm has no tools to build a native module. Install python3, make and g++, or use a prebuilt binary.

output
npm error command sh -c node-gyp rebuildnpm error gyp ERR! find Python Python is not set from command line or npm configurationnpm error gyp ERR! find Python Python is not set from environment variable PYTHONnpm error gyp ERR! find Python checking if "python3" can be usednpm error gyp ERR! find Python - executable path is ""…npm error gyp ERR! stack Error: Could not find any Python installation to use

The package you are installing (or one of its dependencies) has a native C/C++ module, ships no binary for your platform, and npm stopped while building it with node-gyp rebuild. On Unix, node-gyp needs **Python, make, and a C/C++ compiler (such as GCC)**; each missing piece fails with a different line. Slim images such as node:22-slim have none of the three.

[1] Read the gyp ERR! lines to see what is missing. Adding the build tools one at a time and installing the same module changed the error like this:

MissingLine printed
Pythongyp ERR! find Python · Could not find any Python installation to use
make (Python present)gyp ERR! stack Error: not found: make
C/C++ compiler (make present)make: cc: No such file or directory · `Error: make failed with exit code: 2`
NothingInstall succeeds and build/Release/*.node appears

The npm error path line names the package folder that failed to build. Check [4] for that package first — a prebuilt binary may mean you need no tools at all.

[2] Install the build tools. On Debian and Ubuntu (including the official node:*-slim images) it is three packages:

console
# apt-get update && apt-get install -y python3 make g++

With them in place, the same install passed:

console
$ npm install ./addon$ ls addon/build/Release/*.node
output
up to date in 1saddon/build/Release/hello.node

In a Docker image, keep the build tools out of the runtime image with stages. Install the tools and run npm ci in a build stage (FROM node:22-slim AS build), then start the runtime stage from a fresh node:22-slim and bring over only node_modules with COPY --from=build. Both stages need the same Node version and CPU architecture for the built .node files to load.

[3] If Python is installed and you still get find Python, tell node-gyp which Python to use. The node-gyp README lists the --python option, the npm_config_python variable, and the PYTHON variable.

console
$ npm_config_python=/usr/bin/python3 npm install

Check versions too. The node-gyp README states that Python 3.12 or later requires node-gyp 10 or later. This shows the node-gyp bundled with npm (npm 10.9.9 here):

console
$ npm ls -g node-gyp
output
/usr/local/lib`-- npm@10.9.9  +-- @npmcli/run-script@9.1.0  | `-- node-gyp@11.5.0 deduped  `-- node-gyp@11.5.0

If your project pins an old node-gyp as its own dependency, that one runs instead. The gyp ERR! node-gyp -v line at the end of the error is the version actually used.

[4] Look for a release you do not have to build. Many native packages bundle binaries for common platforms. bufferutil installed and loaded in an image with no Python, make, or compiler:

console
$ which python3 make cc g++$ npm install bufferutil$ ls node_modules/bufferutil/prebuilds$ node -e 'require("bufferutil"); console.log("loaded")'
output
added 2 packages in 878msdarwin-arm64darwin-x64linux-x64win32-ia32win32-x64loaded

If your platform (linux-arm64 and so on) is not in the list, the install falls back to building. This release (4.1.0) has no linux-arm64, so an ARM Linux server needs the build tools. If it only fails on a brand-new Node version, check the package's release history for binaries built for that version.

[5] Do not get past it with --ignore-scripts. The install finishes, but no .node file is built and the app fails wherever it loads that module. Once the tools are in, rebuild just that package with npm rebuild <package>.

console
$ npm install ./addon/hello-addon-1.0.0.tgz --ignore-scripts$ node -e 'require("hello-addon")' 2>&1 | grep -m1 Error$ npm_config_python=/usr/bin/python3 npm rebuild hello-addon --foreground-scripts 2>&1 | grep -E 'find Python|rebuilt'$ node -e 'require("hello-addon"); console.log("loaded")'
output
added 1 package in 613msError: Cannot find module './build/Release/hello.node'gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"rebuilt dependencies successfullyloaded

For a dependency linked straight from a folder (npm install ./addon), npm rebuild printed "rebuilt dependencies successfully" without building anything. In that case run npx node-gyp rebuild inside that folder.

If the install stops for another reason, see npm ERR! code ERESOLVE (version conflicts) or npm install -g EACCES (permissions).

#npm#nodejs#node-gyp#native-addon#docker