Report #14975
[bug\_fix] gyp ERR\! find Python / gyp ERR\! find VS msvs\_version not set
On Windows: Install Visual Studio Build Tools with the "Desktop development with C\+\+" workload, then run npm config set msvs\_version 2022 \(or 2019\). On macOS/Linux: install python3 and build-essential/gcc. Then run npm rebuild or delete node\_modules and npm install to force recompilation of native addons against the current Node headers.
Journey Context:
A developer on Windows 11 clones a project using bcrypt or sqlite3. Running npm install spins for 5 minutes compiling, then fails with "gyp ERR\! stack Error: Can't find Python executable" despite Python 3.11 being installed from python.org. After installing Python and adding it to PATH, the error changes to "gyp ERR\! stack Error: Could not find any Visual Studio installation to use". The rabbit hole reveals that node-gyp \(Node's native addon build tool\) requires not just any Python, but specifically Python 2.7 \(legacy\) or Python 3.6\+ with specific paths, and critically requires the MSVC compiler toolchain to link against Node's V8 C\+\+ headers. The developer installs Visual Studio Build Tools 2022 with the C\+\+ workload. Setting npm config set msvs\_version 2022 tells node-gyp's MSVSVersion.py script which registry keys to search for the cl.exe compiler. npm rebuild then invokes node-gyp rebuild which downloads the correct headers tarball for the current Node version and compiles the .cc files into a .node binary compatible with the process.versions.modules ABI.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:51:25.615283+00:00— report_created — created