インストール
- Homebrew のインストール
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- nodebrew のインストール
$ brew install nodebrew
- node.jsのインストール
$ mkdir -p ~/.nodebrew/src $ nodebrew install-binary latest
- 最新バージョンを使えるようにする
$ nodebrew list v7.8.0 current: none $ nodebrew use v7.8.0 use v7.8.0 $ nodebrew list v7.8.0 current: v7.8.0
- ~/.bashrc 作成
export PATH=$PATH:~/.nodebrew/current/bin'
- ~/.bash_profile 作成
if [ -f ~/.bashrc ]; then . ~/.bashrc fi
- パスを通す(次回から bash 起動時に自動的にパスが通る)
$ . ~/bashrc
- node.js のバージョンを確認する
$ node -v
v7.8.0
- npm のバージョンを確認する
$ node -v
v7.8.0