Search code examples
node.jszshnvm

zsh: bad CPU type in executable: node


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.

enter image description here


Solution

  • 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.