CentOS-6.5でnode.js環境構築
nvmのソースコードをcheckout
$ git clone git://github.com/creationix/nvm.git ~/.nvm
.bashrcにnvm.shを書いておく
$ echo . ~/.nvm/nvm.sh >> ~/.bashrc $ . ~/.bashrc
install nodeとuse
お好みのバージョンをインストール
$ nvm install v0.xx.xx
nvm useを実行
$ nvm use v0.xx.xx Now using node v0.xx.xx $ node -v v0.xx.xx
もしインストール中に以下のように怒られたら、足りないパッケージをインストールします。
例えば、
$ nvm install v0.6.7 Additional options while compiling: ######################################################################## 100.0% Checking for program g++ or c++ : not found Checking for program icpc : not found Checking for program c++ : not found /home/user_name/.nvm/src/node-v0.6.7/wscript:261: error: could not configure a cxx compiler! nvm: install v0.6.7 failed!
# yum install gcc-c++
$ nvm install v0.6.7 Additional options while compiling: ######################################################################## 100.0% Checking for program g++ or c++ : /usr/bin/g++ Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok Checking for program gcc or cc : /usr/bin/gcc Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for gcc : ok Checking for library dl : not found Checking for openssl : not found Checking for function SSL_library_init : not found Checking for header openssl/crypto.h : not found /home/sai/.nvm/src/node-v0.6.7/wscript:374: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message. nvm: install v0.6.7 failed!
yum install openssl-devel.x86_64
このように足りてないパッケージをyumでインストールすると、node本体のビルドが通るようになります。
$ nvm install v0.6.7