- node.jsのパッケージ管理ツール"nodebrew"のインストール
$ brew install nodebrew
$ nodebrew setup
$ nodebrew -v
# nodebrew 1.1.0
- インストールできるnode.jsのバージョンを確認
$ nodebrew ls-remote
- 該当のバージョンのnode.jsをインストール
$ nodebrew install-binary v16.3.0
- 該当のバージョンがインストールされている確認
$ nodebrew list
# v16.3.0
#
# current: none
- 適用したいnode.jsのバージョンを指定
$ nodebrew use v16.3.0
# use v16.3.0
- 設定できたか確認
$ nodebrew list
# v16.3.0
#
# current: v16.3.0
- パスを通す(.zshrcファイルで管理している場合)
$ echo 'export PATH="$HOME/.nodebrew/current/bin:$PATH"' >> ~/.zshrc
$ source ~/.zshrc
- 該当のバージョンのnode.jsを利用可能な状態になっていることを確認
$ node -v
# v16.3.0