4

I have installed Node.js and Forever in my Raspberry Pi but I somehow don't know how to get Forever to start my hello.js which is in the /node/ directory. I followed the tutorial, Run NodeJS server on boot with Forever on Raspberry Pi but cannot get it to work

  1. I cannot find /var/www/ in my Raspberry Pi, as Forever seems to look for it to start any file.
  2. if I cd /node/ then run forever start hello.js, it will work.

How can I do something like below?

@reboot /usr/bin/sudo -u pi -H /usr/local/bin/forever start /node/hello.js
1

I figured out how this work. It is because of root directory. In my raspberry pi 3b, the root directory is /home/pi/. So in my case, the whole script will be:

@reboot /usr/bin/sudo -u pi -H /usr/local/bin/forever start /home/pi/node/hello.js

then it works.

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.