Report #30451
[bug\_fix] node-gyp ERR\! find Python / gyp ERR\! find VS / node-gyp rebuild failed
The root cause is that native Node.js addons \(C\+\+ bindings\) require compilation via node-gyp, which depends on Python 3.x and a platform-specific C\+\+ compiler toolchain. The fix is to install the platform-specific build tools: On Windows: Install 'Visual C\+\+ Build Environment' via Visual Studio Build Tools 2019/2022 with the 'Desktop development with C\+\+' workload, or use npm install --global windows-build-tools \(legacy\). On macOS: Run xcode-select --install to install Command Line Tools. On Linux: Install build-essential and python3 \(sudo apt-get install build-essential python3\). Then clear npm cache and rebuild.
Journey Context:
You run npm install on a project using bcrypt, sharp, or sqlite3. The install fails during the 'node-gyp rebuild' phase with 'gyp ERR\! find Python' or on Windows 'Could not find any Visual Studio installation'. You check the logs and see it's trying to compile C\+\+ code. You realize your Docker image or fresh VM lacks build tools. On a Linux CI server, you try apt-get install python but still get errors. You look up node-gyp documentation and see it requires Python 3 and make/g\+\+. You update your Dockerfile to include 'apt-get install -y build-essential python3'. On Windows, you try installing Python from python.org but node-gyp still fails because it needs the MSBuild toolchain. You download Visual Studio Build Tools and select the 'Desktop development with C\+\+' workload. After installation, you set npm config set msvs\_version 2019 and retry. 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-18T05:29:59.879134+00:00— report_created — created