Skip to content

Instantly share code, notes, and snippets.

@nixjs
Created October 1, 2023 00:57
Show Gist options
  • Save nixjs/7dceb54d9d348605dff922fa07804b18 to your computer and use it in GitHub Desktop.
Save nixjs/7dceb54d9d348605dff922fa07804b18 to your computer and use it in GitHub Desktop.

How to fix node-gyp rebuild failed on MacOS

│ In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:141:
│ In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_rsize_t.h:30:
│ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
│ #error architecture not supported
│  ^
│ fatal error: too many errors emitted, stopping now [-ferror-limit=]
│ 20 errors generated.
│ make: *** [Release/obj.target/validation/src/validation.o] Error 1
│ gyp ERR! build error 
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack     at ChildProcess.onExit (/Users/nghinguyen/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:203:23)
│ gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
│ gyp ERR! System Darwin 23.0.0
│ gyp ERR! command "/Users/nghinguyen/.nvm/versions/node/v18.16.0/bin/node" "/Users/nghinguyen/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
│ gyp ERR! cwd /Users/nghinguyen/work/@inspirelab/huula/node_modules/utf-8-validate
│ gyp ERR! node -v v18.16.0
│ gyp ERR! node-gyp -v v9.3.1
│ gyp ERR! not ok 
└─ Failed in 25.9s at /Users/nghinguyen/work/@inspirelab/huula/node_modules/utf-8-validate

Solution:

Run command line: sudo xcode-select --switch /Library/Developer/CommandLineTools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment