LoginSignup
0
1

More than 5 years have passed since last update.

PM2でNode.jsのパスを指定して実行するメモ

Posted at

BLEやGPIOを扱うRaspberry PiだとNode.jsやPM2の実行にsudo実行を求められる場合があります。

ただsudo実行をすると今までに自分(piユーザなど)が使っていたNode.jsやPM2のパスだと使えなかったりします。

https://github.com/Unitech/pm2/issues/1034 にあるように--interpreter=<PATH>を指定すると良さそう。

$ pm2 start app.js --name app1 --interpreter=~/.nvm/versions/node/v0.12.0/bin/node

通常

$ pm2 start app.js --name "ble"

sudo実行

$ sudo /home/pi/.nodebrew/current/bin/pm2 start /home/pi/n0bisuke/findble/app.js --name "ble" --interpreter=/home/pi/.nodebrew/current/bin/node

nodebrew経由でインストールしているので/home/pi/.nodebrew内を指定します。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1