nodebrewでnode.jsの管理
新しいPCでnode.jsを入れ直した際のメモ
nodebrewのインストール
Homebrew経由でnodebrewをインストールしてsetup
$ brew install nodebrew
$ nodebrew setup
コメントに書かれてる通りに実行してからPATHを通します.
// 実行 $ /usr/local/opt/nodebrew/bin/nodebrew setup_dirs // pathの追加 $ echo "export PATH=$HOME/.nodebrew/current/bin:$PATH" >> ~/.bash_profile $ echo "export NODEBREW_ROOT=/usr/local/var/nodebrew" >> ~/.bash_profile // .bash_profileの実行 $ source ~/.bash_profile
nodebrewを使う
nodebrewでよく使うコマンドを載せます.
$ nodebrew ls-all // インストールできるバージョンの確認
$ nodebrew install-binary // インストール
$ nodebrew list // インストールしたバージョンの確認
$ nodebrew use // バージョンの切り替え
nodebrew install コマンドでもインストールできますが基本的にnodebrew install-binaryのほうで入れたほうがよいそうです.