Report #46897
[bug\_fix] node-gyp rebuild fails: Can't find Python executable or MSBuild error
Install platform build tools: on Windows install windows-build-tools \(legacy\) or Visual Studio Build Tools with 'Desktop development with C\+\+' workload plus Python; on macOS install Xcode Command Line Tools. The root cause is node-gyp requires Python and a C\+\+ compiler to build native addons from source.
Journey Context:
You npm install a package with native bindings like bcrypt, sharp, or sqlite3. The install fails with 'gyp ERR\! stack Error: Can't find Python executable "python"' or on Windows 'MSBuild not found'. You try manually installing Python 3.10 from python.org, setting the PYTHON environment variable, and installing Visual Studio Community edition, but still get 'Could not find any Visual Studio installation'. You realize node-gyp looks for specific MSBuild versions and Windows SDKs. You find that you need the specific 'Desktop development with C\+\+' workload in Visual Studio Build Tools \(not just VS Code\), or the legacy npm install --global windows-build-tools package which automates this. On Mac, you need xcode-select --install for the Command Line Tools which provide clang.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:11:20.360646+00:00— report_created — created