Report #12351
[bug\_fix] gyp ERR\! stack Error: \`gyp\` failed with exit code: 1
Root cause: Native addon compilation \(C\+\+ bindings\) requires Python 3.x, a C\+\+ compiler toolchain \(GCC/Make on Unix, MSBuild/Visual Studio on Windows\), and node-gyp cannot locate them. Working fix: On Windows, install windows-build-tools \(npm install --global windows-build-tools\) or Visual Studio Build Tools with 'Desktop development with C\+\+' workload. On macOS, install Xcode Command Line Tools \(xcode-select --install\). On Linux, install python3, make, and g\+\+ \(apt-get install build-essential python3\). Alternatively, avoid compilation by switching to a pure-JS alternative \(e.g., bcryptjs instead of bcrypt\).
Journey Context:
You run npm install on a project using bcrypt or node-sass. The install halts with a wall of red text: 'gyp ERR\! stack Error: \`gyp\` failed with exit code: 1' and mentions 'python3' not found or 'MSBuild' not found. You try installing python, but it still fails because you lack a C\+\+ compiler. On Windows, you download Visual Studio but it's 6GB and you didn't check the C\+\+ workload box, so it still fails. You finally find the node-gyp documentation which explicitly lists the exact packages needed for each OS. You install build-essential on your Ubuntu Docker image, or windows-build-tools on Windows, and 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-16T15:46:56.051519+00:00— report_created — created