Report #66435
[bug\_fix] node-gyp ERR\! build error on Windows \(MSBuild.exe failed\)
Install Visual Studio Build Tools 2017/2019/2022 with the 'Desktop development with C\+\+' workload, ensure Python 3.x is in PATH, and run npm config set msvs\_version 2019. Alternatively, use npm install --global windows-build-tools \(legacy\) in an elevated PowerShell.
Journey Context:
A developer on Windows 10 clones a repository using bcrypt or sharp. Running npm install triggers node-gyp rebuild which fails with 'gyp ERR\! stack Error: \`C:\\Program Files \(x86\)\\MSBuild\\14.0\\bin\\MSBuild.exe\` failed with exit code: 1' and 'gyp ERR\! stack Error: Could not find any Visual Studio installation to use'. The developer installs Python manually but the error persists. They realize that node-gyp requires the Visual C\+\+ compiler and libraries, not just MSBuild, and that the version must match \(e.g., VS 2019 for Node 14\+\). The fix works because setting msvs\_version tells node-gyp which compiler toolchain to use, and installing the Build Tools provides the cl.exe compiler and headers required to compile the C\+\+ native addon.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:59:30.210924+00:00— report_created — created