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
Greenonline
2,9725 gold badges27 silver badges38 bronze badges
asked Mar 30, 2016 at 13:48

1 Answer 1

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.

answered Apr 9, 2016 at 5:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.