1
1

More than 3 years have passed since last update.

Nodebrewでnodeのversionの変え方

Last updated at Posted at 2020-09-04

Nodebrewでnodeのversionの変え方

1. Nodebrewをインストールする

brew install nodebrew

2. 環境変数を追加

vi ~/.bash_profileで、以下を追加。

export PATH=$HOME/.nodebrew/current/bin:$PATH

3. bash_profileを更新して設定を反映させる。

source ~/.bash_profile

4. セットアップ。これやらないとインストールできない。

nodebrew setup

5. バージョン指定してnodeをインストールするために、インストール可能なバージョンを確認

nodebrew ls-remote

6.nodeのインストール(versionを指定する)

nodebrew install-binary <version>

7. 現在自分でインストールしたnodeのversionを確認

nodebrew ls

v10.22.0
v14.9.0

8.currentに出てくるのが、現在利用中のversion。

例えば10.12をインストールしただけで利用するように設定していない場合、noneになる

nodebrew ls

v10.22.0
v14.9.0
current: none

9.nodebrew use v14.9.0 で 既にインストール済みのnodeに切り替えられる

nodebrew use v14.9.0

use v14.9.0

参考リンク

NodebrewでNodeをインストールする
Node.jsのversionを管理するためにnodebrewを利用する

1
1
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
1
1