1

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
USER=pi
OUT=/home/pi/nodejs.log

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

  echo "Usage: /etc/init.d/nodeup {start|stop}"
  exit 1
  ;;
esac
exit 0
3
  • 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 Commented Feb 19, 2016 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
    Commented Feb 19, 2016 at 13:43
  • try forever-service. It's convenient, trust me.
    – Aloha
    Commented Mar 20, 2016 at 14:38

1 Answer 1

1

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 and acknowledge you have read our privacy policy.

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