Report #16859
[bug\_fix] gyp ERR\! stack Error: \`gyp\` failed with exit code: 1
Install the required build tools: on Windows, install the 'Visual C\+\+ Build Environment' and Python 3.x; on macOS, install Xcode Command Line Tools \(\`xcode-select --install\`\); on Linux, install \`build-essential\` and \`python3\` \(e.g., \`apt-get install build-essential python3\`\). Then delete \`node\_modules\` and \`package-lock.json\` and run \`npm install\` again.
Journey Context:
You clone a repo with native dependencies like \`bcrypt\`, \`sharp\`, or \`sqlite3\`, run \`npm install\`, and the install crashes with \`node-gyp\` errors about missing Python or Visual Studio. You install Python from python.org, but the error persists because \`node-gyp\` looks for specific versions or requires specific Visual C\+\+ redistributables. The rabbit hole: you realize \`node-gyp\` is Node's build tool for compiling C\+\+ addons, which requires a full compiler toolchain matching the Node binary's ABI. On Windows, you try \`npm install --global windows-build-tools\` but it's deprecated; you realize you need the 'Desktop development with C\+\+' workload from Visual Studio Build Tools 2019/2022. On macOS, you need Xcode CLI tools not just for git but for the \`clang\` compiler. On Linux, you need \`make\`, \`g\+\+\`, and \`python3\`. The fix works because \`node-gyp\` generates platform-specific build files \(Makefile, .sln\) that invoke these native compilers to build the \`.node\` binary addons against Node's V8 headers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:50:43.784070+00:00— report_created — created