pm2でchinachuがerroredになる時の対処法

症状:centos7でchinachu 0.10.0-gamma.0 をインストールした際に errored になり、起動できない
原因:chinachuをインストールする際にnaveもインストールするが、ハッシュ値比較に利用するコマンドがないためインストールに失敗し実行できない。
解決方法:nave.shの中身を書き換える(コマンドを変える)

lqqqqqqqqqqqqqqqqqqqwqqqqwqqqqqqqqqqqqqqqqwqqqqqqwqqqqqqwqqqqqqqqqwqqqqqqqqqwqqqqqqqqwqqqqqwqqqqqqqqqqqqwqqqqqqwqqqqqqqqqqk
x App name          x id x version        x mode x pid  x status  x restart x uptime x cpu x mem        x user x watching x
tqqqqqqqqqqqqqqqqqqqnqqqqnqqqqqqqqqqqqqqqqnqqqqqqnqqqqqqnqqqqqqqqqnqqqqqqqqqnqqqqqqqqnqqqqqnqqqqqqqqqqqqnqqqqqqnqqqqqqqqqqu
x chinachu-operator x 2  x 0.10.0-gamma.0 x fork x N/A  x errored x 0       x 0      x 0%  x 0 B        x root x disabled x
x chinachu-wui      x 1  x 0.10.0-gamma.0 x fork x N/A  x errored x 0       x 0      x 0%  x 0 B        x root x disabled x
x mirakurun-server  x 0  x 2.11.0         x fork x 5892 x online  x 1       x 27m    x 0%  x 148.9 MB   x root x disabled x
mqqqqqqqqqqqqqqqqqqqvqqqqvqqqqqqqqqqqqqqqqvqqqqqqvqqqqqqvqqqqqqqqqvqqqqqqqqqvqqqqqqqqvqqqqqvqqqqqqqqqqqqvqqqqqqvqqqqqqqqqqj
$pm2 log 
 一部抜粋
PM2   | Stopping app:mirakurun-server id:0
PM2   | App [chinachu-wui:1] starting in -fork mode-
PM2   | App [chinachu-wui:1] online
PM2   | Error: spawn .nave/node ENOENT
PM2   |     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
PM2   |     at onErrorNT (internal/child_process.js:362:16)
PM2   |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
PM2   |     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
PM2   | App [chinachu-operator:2] starting in -fork mode-
PM2   | App [chinachu-operator:2] online
PM2   | Error: spawn .nave/node ENOENT
PM2   |     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
PM2   |     at onErrorNT (internal/child_process.js:362:16)
PM2   |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
PM2   |     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
PM2   | App [mirakurun-server:0] exited with code [0] via signal [SIGINT]
PM2   | pid=22521 msg=process killed
PM2   | App [mirakurun-server:0] starting in -fork mode-
PM2   | App [mirakurun-server:0] online

3) Node.js Environment の部分で
nave.shが実行出来てないのが原因
nave.sh: line 237: shasum: command not found

nave-2.3.0/nave.sh
removed directory: ‘/home/rec/chinachu/.nave/nave-2.3.0’
######################################################################## 100.0%
/home/rec/chinachu/.nave/nave.sh: line 237: shasum: command not found
shasum mismatch, expect 6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52, got 6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52
$vim chinachu/.nave/nave.sh

#shasum というコマンドはcentosにない
237   local actualshasum=$(sha256sum "$cache/$dir/$base" | awk '{print $1}')
238   if ! [ "$shasum" = "$actualshasum" ]; then

chinachuのソースをいじる
ダウンロードし解凍後
144行目に shasum -a 256 を sha256sum 置換するコマンドを入れる

sed -i -e "s/shasum -a 256/sha256sum/" $NAVE_DIR/nave.sh

#alias sha256sum=’shasum -a 256’でもいいかもしれない…

最終的に下記のようなコードになる

$vim chinachu

140   echo "Installing Node using Nave..."
141   wget -O - https://github.com/isaacs/nave/archive/v2.3.0.tar.gz | tar zxvf - -C $NAVE_DIR nave-2.3.0/nave.sh
142   mv $NAVE_DIR/nave-2.3.0/nave.sh $NAVE_DIR/
143   rm -rfv $NAVE_DIR/nave-2.3.0
144   sed -i -e "s/shasum -a 256/sha256sum/" $NAVE_DIR/nave.sh
145   ${NAVE_DIR}/nave.sh install $NODE_VER
146   rm -fv ${NAVE_DIR}/node
147   ln -sv $NODE_PATH ${NAVE_DIR}/node
148   ln -sv $NPM_PATH ${NAVE_DIR}/npm
$ echo "1" | ./chinachu installer

インストールできる。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です