ただ枯れゆく大樹が如く

技術の話やら愚痴やら節操もなく徒然と

nodebrewはbrewでinstallしてはいけない

nodebrewのインストールおよび設定でハマったので備忘録として書いておく。

普通にbrewでインストール

↪ brew install nodebrew

特に問題は発生せず、nodebrew install-binary latestでも正常にインストールできた。

↪ nodebrew list
v10.4.1

current: none

ということなのでインストールしたnodeを有効化しようとしてuseしたのだが、、、

↪ nodebrew use latest
use v10.4.1
↪ nodebrew list
v10.4.1

current: none

と有効化されない。path周りも一通り調べたけどだめだったのでgithubのインストール手順に従う。

githubのインストール手順に従ってインストール

まずその前にhomebrewでインストールしたゴミを削除する。

↪ brew uninstall --force nodebrew

↪ rm -rf $HOME/.nodebrew

以下手順にしたがってインストールする。

nodebrew : https://github.com/hokaccha/nodebrew

↪ 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:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 24569  100 24569    0     0  13048      0  0:00:01  0:00:01 --:--:-- 13048
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew

========================================
Export a path to nodebrew:

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

latestバージョンをインストール

↪ nodebrew install-binary latest
↪ nodebrew list
v10.4.1

current: none

latestバージョンを有効化

↪ nodebrew use latest
use v10.4.1
↪ nodebrew list
v10.4.1

current: v10.4.1

無事にcurrentにlatestバージョンがセットされている。念のためにnodenpmを確認しといたが問題なし。

↪ node -v
v10.4.1
↪ npm -v
6.1.0

最後に

一先ず正常に使える状態にはなったけどコマンド関連はbrewで管理しとかないと環境移行の際に漏れが出てくるので、homebrewでエラーが出ないようにする方法も探していかないとな。