Report #8733
[bug\_fix] node-gyp ERR\! find Python or gyp ERR\! stack Error: Can't find Python
Install Python 3 and ensure the python command is available in PATH, or explicitly configure npm to use the Python 3 path with npm config set python /usr/bin/python3, or use pre-built binaries if available to avoid compilation.
Journey Context:
Developer clones a project using bcrypt, sharp, or sqlite3 on a fresh Ubuntu server or new Mac without Xcode tools. Running npm install fails during the postinstall phase with gyp ERR\! find Python. The error explains that node-gyp requires Python 2.7 or 3.x to compile C\+\+ bindings for these native modules. Developer installs python3 via apt or brew but the error persists because the executable is named python3, not python, and isn't in the PATH that npm sees. They realize node-gyp specifically looks for python. Setting the environment variable PYTHON=/usr/bin/python3 or running npm config set python /usr/bin/python3 tells node-gyp exactly where to find it. On macOS, installing Xcode Command Line Tools \(xcode-select --install\) provides the necessary compilers and Python. Once Python is correctly located, the native module compiles successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:17:21.977473+00:00— report_created — created