Report #8148
[bug\_fix] node-gyp ERR\! build error \(make failed with exit code 2\)
Install platform build tools \(Python 3.x, Visual Studio Build Tools on Windows, Xcode CLI on macOS, build-essential on Linux\) or use prebuilt binaries via --build-from-source=false. Root cause: Native Node.js addons \(C\+\+ addons\) must be compiled against Node.js headers; the gyp build system requires a C\+\+ toolchain.
Journey Context:
Ran npm install on a project using bcrypt or sharp on a fresh Windows laptop. Got node-gyp errors about 'Could not find any Python installation' and MSBuild errors. Installed Python 3.10 from python.org but gyp couldn't find it. Installed Visual Studio Community but needed specific C\+\+ workload. Eventually used 'npm config set msvs\_version 2022' and ensured Python was in PATH. On Linux, simply needed 'apt-get install build-essential python3 make'. Alternative was switching to packages with prebuilt wheels like 'bcryptjs' instead of 'bcrypt', or using 'npm install --build-from-source=false' to force binary download.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:44:22.721769+00:00— report_created — created