Reputation: 749
I have installed nvm using brew. After that, I installed node version of 16 through nvm and check the current version using node -v to see whether the node is working properly. However, when I install version 14 or any other previous versions and runs node -v, it gives this "zsh: bad CPU type in executable: node" message and I have no idea what to do about this, though, installing node v17 and running node -v works as expected. Below are the snippet of the said commands.
Upvotes: 60
Views: 76806
Reputation: 7692
While downloading kibana from x86_64 https://www.elastic.co/downloads/kibana, as of Dec'24, by default it shows aarch64 archival for download.
If aarch64 matches your Mac's architecture, ideally above error "Bad CPU type in executable" should not come. But if it isn't then Mac's architecture mismatch is the primary cause for Bad CPU error.
To check for Mac's architecture type:
Look for the "Chip" or "Processor" line.
Upvotes: 0
Reputation: 694
I was getting this error when I pushed to a Git repository
chip: Apple M3 Pro
macOS: Sonoma
version: 14.1
Error:
env: node: Bad CPU type in executable
husky - pre-commit hook exited with code 126 (error)
Solution was:
softwareupdate --install-rosetta
When I ran the above command, I had to agree to the terms by typing 'A'.
I have read and agree to the terms of the software license agreement. A list of Apple SLAs may be found here: https://www.apple.com/legal/sla/
Type A and press return to agree:
Type A and press return to agree:
A
Then screen message was:
softwareupdate[276:1180259] Package Authoring Error: 042-41726: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Final message was:
Install of Rosetta 2 finished successfully
Upvotes: 1
Reputation: 2541
This is CPU related issue. It seems that your MacBook Air's CPU is Apple Silicon (M1).
You need update node version architecture on NVM.
softwareupdate --install-rosetta
Further details can be founded on NVM doc, "Macs with M1 chip" section.
Upvotes: 170