LoginSignup
56
52

More than 5 years have passed since last update.

nodebrewでNode.jsのインストール

Last updated at Posted at 2014-10-05

最新版と安定版のNode.jsをそれぞれ使いたくなったので、nodebrewで管理することにしました。

nodebrewのインストール

nodebrewのGitHubサイトに記載がある通り、以下のようにコマンドを実行してインストールします。

nodebrewのインストール
$ curl -L git.io/nodebrew | perl - setup
実行例
$ curl -L git.io/nodebrew | perl - setup
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
100 20027  100 20027    0     0   5846      0  0:00:03  0:00:03 --:--:-- 77324
fetching nodebrew...
install nodebrew in $HOME/.nodebrew

========================================
Add path:

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

~/.zshrcにPATHの追記(zsh使用の場合)

~/.nodebrew配下にインストールされるので、コマンド実行できるようにするため、インストール時に出力されている通り、PATHを追加します。
zshを使用している場合は~/.zshrcに、bashを使用している場合は~/.bashrcに追記してください。

.zshrc
export PATH=$HOME/.nodebrew/current/bin:$PATH
設定の読み込み
$ source ~/.zshrc

Node.jsのインストール

最新版と安定版をそれぞれインストールします。
ここではlatestとstableで指定していますが、もちろんバージョン指定でのインストールもできます。

最新版インストール
$ nodebrew install-binary latest
安定版インストール
$ nodebrew install-binary stable

使用するバージョンの指定

使用するNode.jsのバージョンを指定します。
ここでは最新版を使用するように指定します。

使用するバージョンの指定
$ nodebrew use latest
use v0.11.14
バージョンの確認
$ node -v
v0.11.14
56
52
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
56
52