GrepBoard/매뉴얼
605 편 ·

gyp ERR! find Python · not found make 해결

·시험 환경 Node.js 22.23.4 · npm 10.9.9 · node-gyp 11.5.0 · Debian 12 (Docker node:22-slim) · 2026-10·시험 범위 ↓·5 단계

gyp ERR! find Python · Error: not found: make 는 네이티브 모듈을 빌드할 도구가 없다는 뜻입니다. python3·make·g++ 를 넣거나 미리 빌드된 판을 씁니다.

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

설치하려는 패키지(또는 그 의존성) 안에 C/C++ 로 된 네이티브 모듈이 있고, 그 패키지가 지금 플랫폼용 바이너리를 같이 주지 않아 npm 이 node-gyp rebuild 로 직접 빌드하려다 멈춘 것입니다. node-gyp 문서가 유닉스에서 요구하는 것은 **Python · make · C/C++ 컴파일러(GCC 등)** 셋이고, 하나라도 없으면 그 자리에서 다른 문구로 멈춥니다. node:22-slim 처럼 가벼운 이미지에는 셋 다 없습니다.

[1] gyp ERR! 줄에서 무엇이 없는지 읽습니다. 빌드 도구를 하나씩 넣어 가며 같은 모듈을 설치하면 오류가 이렇게 바뀌었습니다.

없는 것나온 줄
Pythongyp ERR! find Python · Could not find any Python installation to use
make (Python 은 있음)gyp ERR! stack Error: not found: make
C/C++ 컴파일러 (make 까지 있음)make: cc: No such file or directory · `Error: make failed with exit code: 2`
없음설치 성공 · build/Release/*.node 생김

npm error path 줄이 빌드하다 멈춘 패키지 폴더를 알려 줍니다. 그 패키지 이름으로 [4] 의 미리 빌드된 판이 있는지 먼저 봅니다. 있으면 도구를 넣지 않아도 됩니다.

[2] 빌드 도구를 넣습니다. Debian·Ubuntu 계열(공식 node:*-slim 이미지 포함)에서는 세 패키지입니다.

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

넣은 뒤 같은 설치가 통과했습니다.

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

Docker 이미지라면 빌드 도구가 운영 이미지에 남지 않게 단계를 나눕니다. 빌드 단계(FROM node:22-slim AS build)에서 도구를 넣고 npm ci 를 한 뒤, 운영 단계는 새 node:22-slim 에서 시작해 node_modules 만 COPY --from=build 로 가져옵니다. 두 단계의 Node 판과 CPU 가 같아야 빌드된 .node 파일이 그대로 돕니다.

[3] Python 이 있는데도 find Python 이 나면 node-gyp 가 쓸 Python 을 직접 지정합니다. node-gyp 문서가 꼽는 길은 --python 옵션, npm_config_python 환경 변수, PYTHON 환경 변수입니다.

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

판도 봅니다. node-gyp 문서는 「Python 3.12 이상은 node-gyp 10 이상이 필요하다」고 적고 있습니다. npm 에 딸린 node-gyp 판은 이렇게 확인합니다. 아래는 npm 10.9.9 의 결과입니다.

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

프로젝트가 옛 node-gyp 를 직접 의존성으로 고정해 두었으면 이 판이 아니라 그쪽이 쓰입니다. 오류 끝의 gyp ERR! node-gyp -v 줄이 실제로 쓴 판입니다.

[4] 빌드하지 않아도 되는 판을 찾습니다. 많은 네이티브 패키지가 흔한 플랫폼용 바이너리를 패키지 안에 넣어 둡니다. bufferutil 은 Python·make·컴파일러가 하나도 없는 이미지에서 그대로 설치되고 불러와졌습니다.

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

목록에 지금 플랫폼(linux-arm64 등)이 없으면 그 플랫폼에서는 빌드로 넘어갑니다. 위 판(4.1.0)에는 linux-arm64 가 없으므로 ARM 리눅스 서버에서는 빌드 도구가 필요합니다. 막 나온 Node 판에서만 실패하면, 그 패키지가 새 Node 판용 바이너리를 냈는지 패키지의 릴리스 기록을 봅니다.

[5] --ignore-scripts 로 넘기지 않습니다. 설치는 끝나지만 .node 파일이 만들어지지 않아, 실행할 때 그 모듈을 불러오는 곳에서 실패합니다. 도구를 넣은 뒤에는 npm rebuild <패키지> 로 그 패키지만 다시 빌드합니다.

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

file: 로 폴더를 그대로 연결한 의존성(npm install ./addon)은 npm rebuild 가 「rebuilt dependencies successfully」를 찍고도 빌드하지 않았습니다. 그때는 그 폴더에서 npx node-gyp rebuild 를 직접 돌립니다.

설치가 다른 이유로 멈추면 npm ERR! code ERESOLVE(판 충돌), npm install -g EACCES(권한)를 봅니다.

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