How to install Node.js version 14 on macOS M1

Node.js version 14 on macOS M1

First, you need to install Rosetta on your Apple Silicon / M1 resource. This can be done by using CircleCI's macOS orb. Here's an example of how to do it:
orbs:
macos: circleci/macos@2.4.1

jobs:
build:
macos:
xcode: "14.3.1"
resource_class: macos.m1.medium.gen1
steps:
- macos/install-rosetta
...
Next, you can change the Node.js version in your macOS executor. Here's an example of how to do it:
version: 2
jobs:
build:
docker:
- image: circleci/node:6
steps:
- checkout
- run:
name: install node@14
command: |
set +e
touch $BASH_ENV
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
echo nvm install 14 >> $BASH_ENV
echo nvm alias default 14 >> $BASH_ENV
- run:
name: verify node version
command: node --version
 
Please replace node@12.14.1 with node@14 in the above example to install Node.js version 14.
 
It's important to note that the macOS M1 Gen1 resource classwas sunsetted on October 2, 2023 so you might need to update your configuration to avoid build errors.
 

Additional Resources

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.