CentOS7 nodebrewからNode.jsをインストール
概要
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