This error occurs when building native Node.js modules on macOS and you haven't accepted the Xcode license agreement. The fix requires running a simple command with admin privileges to accept the license.
This error appears when npm tries to compile native Node.js modules (like node-gyp, bcrypt, or sharp) on macOS, but the Xcode Command Line Tools license hasn't been accepted yet. macOS requires explicit acceptance of Apple's license agreement before development tools can be used. Native modules that need compilation rely on these tools, so the build process fails until the license is accepted. This commonly happens after installing or updating Xcode, upgrading macOS, or on fresh developer machine setups.
Run the following command to accept the Xcode license agreement:
sudo xcodebuild -license acceptYou'll need to enter your admin password. This accepts the license non-interactively.
If you want to read the license first:
sudo xcodebuild -licenseScroll through the license text (press Space), then type "agree" at the prompt.
Make sure the Command Line Tools are properly installed:
xcode-select --installIf they're already installed, you'll see a message saying so. Otherwise, follow the GUI prompts.
After accepting the license, retry your installation:
npm installNative modules should now compile successfully.
If you have multiple Xcode versions installed, ensure the correct one is selected:
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperFor CI/CD pipelines on macOS, include the license acceptance step in your setup:
- run: sudo xcodebuild -license acceptIf you only need Command Line Tools (not full Xcode), you can install them standalone and they have a simpler license process. However, some native modules may still require full Xcode.
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