Monday, August 25, 2025

@esbuild/darwin-arm64 and @esbuild/darwin-x64 npm build issue


Original error when building the project.

Specifically the "@esbuild/darwin-arm64" package is present but this platform needs the "@esbuild/darwin-x64" package instead. People often get into this situation by installing esbuild with npm running inside of Rosetta 2 and then trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta 2 is Apple's on-the-fly x86_64-to-arm64 translation service).


Clear old binaries

Remove the incorrect esbuild install:

rm -rf node_modules/esbuild node_modules/@esbuild


Reinstall with matching architecture

    • If you want ARM64 (Apple Silicon, recommended):

      arch -arm64 npm install esbuild
    • If you want x64 (Intel / Rosetta):

      arch -x86_64 npm install esbuild
  • Ensure Node matches

    • Check what architecture your Node process is:

      node -p "process.arch"


  • No comments:

    Post a Comment