Report #83938
[bug\_fix] gyp ERR\! build error \| gyp ERR\! stack Error: \`gyp\` failed with exit code: 1
Install Python 3.7-3.11 \(avoid 3.12\+ with old node-gyp\), ensure Python is in PATH, and install platform build tools: Visual Studio Build Tools with 'Desktop development with C\+\+' workload on Windows, or Xcode Command Line Tools on macOS
Journey Context:
Developer on a fresh machine clones a repository and runs npm install. The install fails while building native dependencies like bcrypt or sharp, showing a long stack trace ending with node-gyp errors about missing Python or C\+\+ compiler. On Windows, it complains about missing MSBuild or vcvarsall.bat. On macOS, it mentions xcrun or missing clang. The developer installs Python 3.12 from the official site but the error changes to complain about missing 'distutils' because Python 3.12 removed that module and older node-gyp versions require it. The root cause is that node-gyp \(Node.js native addon build tool\) requires Python as a build script interpreter for GYP \(Generate Your Projects\) and a C\+\+ toolchain to compile native code against Node.js headers. The fix is to install Python 3.11 \(or configure node-gyp 10\+ for Python 3.12\), ensure it's accessible as 'python3' or via the PYTHON environment variable, and install the platform-specific C\+\+ build tools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:28:39.455049+00:00— report_created — created