LoginSignup
122
115

More than 5 years have passed since last update.

Macでnodeのバージョン切り替え -nodebrew の使い方-

Posted at

公式

インストール済みのバージョンを調べる

$ nodebrew ls
v10.10.0
v10.14.0
v11.3.0

current: v10.14.0

current: v10.14.0の部分が現在適応されているバージョンです。
以下のコマンドでも同じことができます。

$ nodebrew list

インストールできるNode.jsのバージョンを調べる

$ nodebrew ls-remote

インストールする

$ nodebrew install <version>

<version>では以下の表記が使えます。

  • v10.14.0
  • 10.14.0
  • stable (= 安定版)
  • latest (= 最新版)

使用するバージョンを切り替える

$ nodebrew use <version>

<version>では以下の表記が使えます。

  • v10.14.0
  • 10.14.0
  • stable (= 安定版)
  • latest (= 最新版)

インストールされていないバージョンに切り替えることはできません。
先にインストールする必要があります。

アンインストールする

$ nodebrew uninstall <version>

<version>では以下の表記が使えます。

  • v10.14.0
  • 10.14.0

一時的に他のバージョンでコマンドを実行する

$ nodebrew exec <version> -- <command>

# 例えば以下のように使います
$ nodebrew exec latest -- node app.js
122
115
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
122
115