LoginSignup
1
1

More than 5 years have passed since last update.

メモ:MacOSX(El Capitan)にNode.jsをNVMでインストール

Posted at

Mac(El Capitan)にNode.jsをNVMでインストール

手順

ターミナルから作業します。

確認・準備

ホームディレクトリに.bash_profileがあるかどうか確認し、なければ作成します。

$ ls ~/.bash_profile
ls: /Users/genova-ishii/.bash_profile: No such file or directory

$ touch ~/.bash_profile

NVMをインストール

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

.bash_profileを読み込みなおしてNVMを使えるようにします。

$ source ~/.bash_profile

確認します

$ nvm --version
0.31.4

Node.jsの安定版(Stable)をインストール

コマンド:nvm install stable
※バージョンを指定したい場合:nvm install v0.12

$ nvm install stable
Downloading https://nodejs.org/dist/v6.4.0/node-v6.4.0-darwin-x64.tar.gz...
######################################################################## 100.0%
Now using node v6.4.0 (npm v3.10.3)
Creating default alias: default -> stable (-> v6.4.0)

確認します

$ node -v
v6.4.0

Node.jsの長期間安定版(LTS)をインストール

コマンド:nvm install --lts

$ nvm install --lts
Installing latest LTS version.
Downloading https://nodejs.org/dist/v4.5.0/node-v4.5.0-darwin-x64.tar.gz...
######################################################################## 100.0%
Now using node v4.5.0 (npm v2.15.9)
nvm_ensure_default_set: a version is required

確認します

$ node --version
v4.5.0

バージョンの切り替え

nvm use <version|alias>

$ nvm use stable
Now using node v6.4.0 (npm v3.10.3)

$ node --version
v6.4.0

以上です

参考

1
1
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
1
1