Change node version in macos image

Came across an issue in the new macos image where the supplied version of node causes some issues running a postinstall script for fsevents. I wanted to use an older version of node to get around it - but we can’t simply specify a node version in macos images.

By my reckoning, there are two different ways to get around this. Nuke the current install and reinstall, with homebrew

bash-3.2$ brew unlink node
bash-3.2$ brew install node@8
bash-3.2$ brew link --overwrite node@8 --force

or install NVM and install the desired node version that way:

- run:
    name: Setup NVM
    command: |
      export NODE_VERSION=$(cat .nvmrc)
      curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash -s -- --no-use
      echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
      echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
      echo 'nvm install v8.14.0' >> $BASH_ENV
      echo 'nvm alias default v8.14.0' >> $BASH_ENV

Am I going about this the right way? Anything I’ve done that’s either incorrect, or missing the point?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.