I've installed node 0.10.2 and forever on my raspberry pi. I had to update npm in order to install forever. I've created the following bash script to run my node app, but when I run it, it just prints the forever help without ever actually starting forever. Even when I simply try to execute just the one line

sudo /opt/node/bin/forever start -p /root/.forever --sourceDir=/home/pi/nodecode/server.js 

it still does not seem to work. My only thoughts are that perhaps it's an incompatible version of forever

export PATH=$PATH:/opt/node/bin
export NODE_PATH=$NODE_PATH:/opt/node/lib/node_modules
export HOME=/root

case "$1" in
    echo "starting node"
    sudo -u $USER /opt/node/bin/forever start -p /root/.forever --sourceDir=/home/pi/nodecode/server.js 
    exec /opt/node/bin/forever stopall

  echo "Usage: /etc/init.d/nodeup {start|stop}"
  exit 1
exit 0
  • have you tried node 5.6.0 or at least 4.2.1 LTS - much more up to date! look for the armv6 (pi1) or armv7 (pi2) install Feb 19 '16 at 3:46
  • hmmm, no I did not know that that there was an arm executable for 5.6.0, I'm actually trying to server angular.js and the version of angular im using requires 0.10.x
    – user379468
    Feb 19 '16 at 13:43
  • try forever-service. It's convenient, trust me.
    – Aloha
    Mar 20 '16 at 14:38

It appears that the command was wrong

sudo -u $USER /opt/node/bin/forever start -p /root/.forever --sourceDir=/home/pi/nodecode/server.js 
should be

sudo -u $USER /opt/node/bin/forever start /home/pi/nodecode/server.js -p /root/.forever 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.