Report #77768
[bug\_fix] gyp ERR\! stack Error: \`make\` failed with exit code: 2 ... node-gyp rebuild
Install platform build tools: build-essential/gcc/g\+\+ on Linux, Xcode Command Line Tools on macOS, or Visual Studio Build Tools with C\+\+ workload on Windows; ensure Python 3.x is installed and accessible via npm config set python /path/to/python3.
Journey Context:
Developer clones a repository and runs npm install. The install fails during the node-gyp rebuild phase for a native dependency like bcrypt, sharp, or sqlite3. The error log shows make failed with exit code 2, or Python executable not found. Developer realizes these packages contain C\+\+ addons that must be compiled against Node.js headers. On macOS, they run xcode-select --install to get clang/gcc. On Linux \(Ubuntu/Debian\), they install apt-get install build-essential python3-dev. On Windows, they install windows-build-tools npm package or Visual Studio Build Tools with the "Desktop development with C\+\+" workload. They then set npm config set python python3.exe \(or python3 on Unix\) so node-gyp finds the Python interpreter needed by the build scripts \(gyp\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:07:47.235547+00:00— report_created — created