The 'gyp ERR! configure error' occurs when npm fails to compile native Node.js modules due to missing system dependencies, build tools, or Python. This happens during npm install when a package requires compilation.
Node-gyp is a tool that compiles native C/C++ modules for Node.js packages. When you run npm install, gyp attempts to configure and build these native modules using your system's C++ compiler and Python. The 'configure error' means gyp failed to validate or set up your build environment—typically because required build tools, compilers, or Python are missing.
Start with a clean slate:
npm cache clean --force
rm -rf node_modules package-lock.jsonEnsure you're using a stable version:
node --versionUpgrade to the latest LTS from https://nodejs.org or use nvm:
nvm install --lts
nvm use --ltsWindows (PowerShell as Administrator):
npm install --global --production windows-build-toolsAlternatively, install Visual Studio Build Tools with 'Desktop development with C++' workload.
macOS:
xcode-select --installLinux (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install build-essential python3Check Python is accessible:
python3 --version
which python3Configure npm to use Python:
npm config set python python3Ensure you have the latest node-gyp:
npm install --global node-gyp@latestOnce build tools are installed:
npm installOn Docker/containers, base images often lack build tools—add them in your Dockerfile: RUN apt-get install -y build-essential python3. In CI/CD environments, ensure your runner has access to compilers. Some organizations use pre-built binary caches to avoid recompilation entirely. Windows-build-tools installation requires ~3GB disk space and Administrator privileges.
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