0
0

More than 3 years have passed since last update.

node.jsのバージョン設定[Homebrew, nodebrew, node.js]

Posted at

node.jsのインストールからバージョン設定まで

  1. Homebrewを用いたnodebrewをインストール
  2. nodebrewを用いて、該当のnode.jsのバージョンをインストール
  3. 該当のnode.jsを使用可能にする(パスを通す・バージョンを選択
- 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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0