How can I update node version on macos executor?
I have already tried this Change node version in macos image, but it did not work as homebrew is always being updated, but not ruby which causes some random failures on CI and the second script do not install nvm even running the commands below
HOMEBREW_NO_AUTO_UPDATE=1 brew install nvm >/dev/null
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 12
nvm alias default 12
I get nvm: command not found:
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12461 100 12461 0 0 47210 0 --:--:-- --:--:-- --:--:-- 47380
=> Downloading nvm from git to '/Users/distiller/.nvm'
=> Cloning into '/Users/distiller/.nvm'...
remote: Enumerating objects: 261, done.
remote: Counting objects: 100% (261/261), done.
remremote: Compressing objects: 100% (227/227), done.
remote: Total 261 (delta 31), reused 99 (delta 25), pack-reused 0
Receiving objects: 100% (261/261), 115.89 KiB | 12.88 MiB/s, done.
Resolving deltas: 100% (31/31), done.
Note: checking out '6597e11971c5c71da97b67e9e8786dec23d52hn7'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
=> Compressing and cleaning up git repository
=> Appending nvm source string to /Users/distiller/.bashrc
=> Appending bash_completion source string to /Users/distiller/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
/bin/bash: line 4: nvm: command not found
/bin/bash: line 5: nvm: command not found
Trying to update with Homebrew:
brew unlink node >/dev/null
brew install node@12 >/dev/null
brew link --overwrite node@12 --force >/dev/null
I get the error about ruby version, because of the Homebrew updates automatically:
Updating Homebrew…
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz
/usr/local/Homebrew/Library/Homebrew/brew.rb:10:in `<main>': Homebrew must be run under Ruby 2.6! You're running 2.3.7. (RuntimeError)
Exited with code exit status 1