タイトルもリスペクト
ヾ(・ω<)ノ" 三三三● ⅱⅲ コロコロ♪
------------------- ↓ 余談はここから ↓-------------------
こんなエラーが出た
[xxx@dozo ~]$ npm install socket.io -g
> bufferutil@1.2.1 install /home/xxx/.nodebrew/node/v5.3.0/lib/node_modules/socket.io/node_modules/bufferutil
> node-gyp rebuild
make: ディレクトリ `/home/xxx/.nodebrew/node/v5.3.0/lib/node_modules/socket.io/node_modules/bufferutil/build' に入ります
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
../src/bufferutil.cc:16 から include されたファイル中:
../../nan/nan.h:41:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from ../src/bufferutil.cc:7:
requires a C++11 compiler
からわかるように、
どうもコンパイラが古いらしい。
はてどうしようか。
調べてみるとcentos6.xでnodejs4.xを利用するという記事を見つけたのだが。
ちょっと難しくやり過ぎな感じだったので整理してみよう。
nodeのインストールは、ソースからやるとコンパイルが長いし基本バイナリでいいかな。
あとバージョン管理やら多人数使用もしたいからnodebrew使おうかねぇ。
例によって1からインストールするので適当にすっ飛ばして読んで。
------------------- ↑ 余談はここまで ↑ -------------------
ヾ(・ω<)ノ" 三三三● ⅱⅲ コロコロ♪
------------------- ↓ 本題はここから ↓-------------------
node.js
準備
まずは必要なパッケージを組み込む。
gcc4.8以上のパッケージを入れるのでdevtools-2を使用
$ sudo wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ centos-release-SCL
nodebrewのインストール
$ curl -L git.io/nodebrew | perl - setup
$ cat >> .bashrc
export PATH=$HOME/.nodebrew/current/bin:$PATH
^C
$ source .bashrc
確認
$ nodebrew --version
nodebrew 0.9.3
~~~
node.jsとnpmのインストール
$ nodebrew install-binary stable
$ nodebrew use stable
確認
$ node --version
v5.4.0
$ npm --version
3.3.12
devtoolset-2を使ってnpmインストール
$ scl enable devtoolset-2 "npm install -g bufferutil"
------------------- ↑ 本題はここまで ↑ -------------------
ヾ(・ω<)ノ" 三三三● ⅱⅲ コロコロ♪
------------------- ↓ 後書はここから ↓-------------------
nodebrewのインストール先
/home/xxx/.nodebrew/current/bin
devtoolset-2のインストール先
/opt/rh/devtoolset-2/
なんでまたこんなところにインストールされるんや
------------------- ↑ 後書はここまで ↑ -------------------