How to fix npm ERR! code ENOTSUP npm ERR! notsup Unsupported CPU: {"cpu":"x64"} (current: {"cpu":"arm64"}) in npm
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.
Quick fix
Fixes ENOTSUP
rm -rf node_modules package-lock.json
npm install- Delete node_modules and reinstall
- Verify your Node.js architecture
- Use nvm to manage Node.js installations
- Fix Docker architecture mismatches
rm -rf node_modules package-lock.jsonnpm installnpm ERR! code ENOTSUPnpm ERR! notsup Unsupported CPU: {"cpu":"x64"} (current: {"cpu":"arm64"})
What this error means
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.
Typical symptoms
- Error mentions x64 vs arm64 architecture mismatch
- Package installed on one machine but fails on another
- Works on Intel Mac but fails on Apple Silicon Mac (or vice versa)
- Docker container fails with architecture errors
- CI/CD builds fail while local development works
- Error message: 'binaries cannot be used on the [arch] platform'
- npx commands fail to find locally installed packages
Common causes
- Copying node_modules between machines with different CPU architectures
- Installing packages with Rosetta (x64 emulation) then running native arm64 Node.js
- Docker image architecture doesn't match host system
- CI/CD runner uses different architecture than deployment target
- Mixed Node.js installations (some x64, some arm64) on Apple Silicon
- Using node_modules from a mounted volume across different architectures
How to fix "npm ERR! code ENOTSUP npm ERR! notsup Unsupported CPU: {"cpu":"x64"} (current: {"cpu":"arm64"})"
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.
Advanced notes
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.
Frequently asked questions
- What does "ENOTSUP" mean?
- 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.
- How do I fix "ENOTSUP"?
- 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.
- What causes "ENOTSUP"?
- Copying node_modules between machines with different CPU architectures Installing packages with Rosetta (x64 emulation) then running native arm64 Node.js Docker image architecture doesn't match host system
- Is the "ENOTSUP" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.