nodejs 'forever' just doesn't do anything

无人久伴 提交于 2019-12-05 01:24:58

I was also not receiving any stdout input from any forever command and this fix nailed it:

sudo ln -s /usr/bin/nodejs /usr/local/bin/node

Hope that helps someone.

I don't know if this will help, but as an alternative, you can use upstart. Create a script like this:

#this is the upstart service task. move it to /etc/init/nodeapp.conf

description "server for Node App"
author "Neels Grobler"

chdir /root/servers/nodeapp
exec node init.js 1>stdout.log 2>stderr.log
respawn

And run it by typing start nodeapp. To stop type stop nodeapp. You can also change the script so that the node app starts on system boot etc. More info at upstart.ubuntu.com

You should be using forever start server.js not just forever server.js

On windows, when you run forever like:

forever start app.js

you can find generated log file in file system at:

C:\Users\USERNAME\.forever\SomeLogFileHere.txt

The log files are regenerated for every running script with unique identicator of each file. You can always check which file belongs to which process by:

forever list

Several guesses.

  • If you install using sudo npm install forever -g, you might need to sudo to run forever.
  • Put a full path of server.js when you run forever such as forever start /home/you/source/server.js or sudo forever start /home/you/source/server.js
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!