Report #104409
[bug\_fix] npm ERR\! ELIFECYCLE Command failed with exit code 1 \(node-gyp rebuild\)
Install build-essential, python3, and make on Linux, or install Visual Studio Build Tools and Python on Windows, then run npm rebuild.
Journey Context:
I was setting up a Node.js project with the bcrypt package on a fresh Ubuntu 22.04 server. Running npm install failed with ELIFECYCLE during the node-gyp rebuild step for bcrypt. The error logs showed 'gyp: No Xcode or CLT version detected\!' and 'make: not found'. I initially tried npm cache clean and reinstalling, but the root cause was missing C\+\+ build tools. On Linux, node-gyp requires gcc, g\+\+, and make \(from build-essential\) plus Python 3. Installing build-essential and ensuring python3 was in PATH fixed it. On Windows, the fix involves Visual Studio Build Tools with 'Desktop development with C\+\+' workload and Python. The real root cause is that many native modules \(bcrypt, sharp, node-sass\) compile C\+\+ code at install time, and node-gyp needs a full build toolchain.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:04:35.227629+00:00— report_created — created