The ENOTSUP CPU error occurs when npm packages contain native binaries built for a different processor architecture (x64 vs arm64). This commonly happens on Apple Silicon Macs or when copying node_modules between systems. Delete node_modules and reinstall on the target machine.
This error occurs when npm packages include prebuilt native binaries compiled for a specific CPU architecture, but you're trying to run them on a different architecture. The most common scenario is x64 (Intel/AMD) vs arm64 (Apple Silicon, AWS Graviton, Raspberry Pi). When you install packages like esbuild, sharp, or other native modules, npm downloads binaries matching your system's architecture. If those binaries are then executed on a different architecture—such as copying node_modules from an Intel Mac to an M1 Mac—they won't run. This error has become increasingly common since Apple's transition to Apple Silicon (M1/M2/M3 chips) and the growing adoption of ARM-based servers.
The most reliable fix is a clean reinstall on the target architecture:
rm -rf node_modules package-lock.json
npm installThis downloads binaries matching your current system's architecture.
Check which architecture Node.js is running:
node -p "process.arch"On Apple Silicon, this should return arm64 for native mode or x64 if running under Rosetta. Ensure you're using the correct Node.js build for your system.
Install nvm and ensure you have native arm64 Node.js on Apple Silicon:
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install native arm64 Node.js
nvm install 20
nvm use 20
# Verify
node -p "process.arch" # Should show "arm64"Specify the correct platform in Docker:
# For arm64 (Apple Silicon, Graviton)
FROM --platform=linux/arm64 node:20
# For x64 (Intel/AMD)
FROM --platform=linux/amd64 node:20Or set the platform when building:
docker build --platform linux/amd64 -t myapp .Add node_modules to .gitignore and .dockerignore:
# .gitignore and .dockerignore
node_modules/Always run npm install or npm ci on the target system rather than copying node_modules from another machine.
For packages that support it, specify the target architecture:
npm install --arch=arm64 --platform=darwin sharpThis downloads binaries for the specified architecture regardless of your current system.
On Apple Silicon Macs, you might have multiple Node.js installations: one native arm64 (fast) and one x64 running under Rosetta (slower but compatible with older packages). Check with which node and file $(which node) to see which you're using.
If you installed Node.js via Homebrew on an Apple Silicon Mac before 2021, you might have the x64 version. Reinstall Homebrew and Node.js to get native arm64 builds:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install nodeFor CI/CD on GitHub Actions, use the runs-on directive to match your deployment architecture:
jobs:
build:
runs-on: ubuntu-latest # x64
# or
runs-on: macos-latest # arm64 on newer runnersSome packages like esbuild publish architecture-specific packages (@esbuild/darwin-arm64, @esbuild/linux-x64). If you see errors about these optional dependencies, your package.json or lockfile may have the wrong architecture specified.
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