This error indicates that macOS Command Line Tools are missing, which are required for compiling native Node.js modules. Install them using xcode-select to resolve the issue.
This error occurs when npm attempts to build a native Node.js module but can't find the necessary compilation tools on your macOS system. Native modules (written in C/C++) need a compiler and related build tools to install. On macOS, these are provided by the Xcode Command Line Tools package, which includes clang, make, and other essential development utilities. The error message helpfully tells you exactly what command to run to fix it.
Run the installation command:
xcode-select --installA dialog will appear asking you to install the tools. Click "Install" and wait for the download to complete (may take several minutes depending on your internet connection).
After installation completes, verify the tools are working:
xcode-select -pThis should output something like:
/Library/Developer/CommandLineToolsAlso verify gcc is available:
gcc --versionNow retry your package installation:
npm installNative modules should compile successfully.
If the Command Line Tools installation fails or is corrupted, remove and reinstall:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --installThis forces a fresh installation.
If you have full Xcode installed, you may need to set the correct developer directory:
sudo xcode-select --switch /Library/Developer/CommandLineToolsOr to use Xcode's tools:
sudo xcode-select --switch /Applications/Xcode.app/Contents/DeveloperFor headless CI environments, you can install Command Line Tools non-interactively:
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
softwareupdate -i -a
rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progressThe Command Line Tools package is about 500MB-1GB, so ensure sufficient disk space.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error