1.21 jigowatts

Great Scott!

CentOS7 nodebrewからNode.jsをインストール

概要

Node.jsのバージョン管理ツールであるnodebrewからNode.jsをバージョン指定してインストールします。

検証環境

CentOS 7
(OS X v10.11 El Capitanでも確認)

nodebrewインストール

# yum update -y
# curl -L git.io/nodebrew | perl - setup

環境変数の設定

.bash_profileに以下を追加

# vim ~/.bash_profile
export PATH=$HOME/.nodebrew/current/bin:$PATH

.bash_profileを読み直し後、nodebrewコマンドが実行できればOK

# source ~/.bash_profile
# nodebrew help

Node.jsインストール

バージョン確認

# nodebrew ls-remote

バージョンを指定してインストール

# nodebrew install-binary <version>

安定版のインストール

# nodebrew install-binary stable

インストールしたNode.jsのバージョン確認

# nodebrew list

Node.jsのバージョンを指定

# nodebrew use <version>

Node.jsの安定版を指定

# nodebrew use stable

Node.jsとnpmのバージョン確認

# node -v
# npm -v