问题描述
我想使用一个永远的Amazon EC2实例上运行我的nodejs的应用程序。我安装nodejs NPM,然后跑到 sudo的NPM安装永远-g
。
安装没有返回任何错误,所以我继续前进,尝试使用永远启动server.js
运行我的应用程序,但它不会做任何事情 - 没有输出乜因此,以往,甚至不是一个错误。
我也试过永远--help
和公正的永远
,但没有人给我任何回应...
I am trying to run my nodejs app on an Amazon EC2 instance using forever. I installed nodejs npm, and then ran sudo npm install forever -g
.
The installation didn't return any errors, so i go ahead and try running my app using forever start server.js
, but it won't do anything - no output what-so-ever, not even an error.
I also tried forever --help
and just forever
, but none of them giving me any response...
在运行我的应用程序经常使用nodejs - nodejs init.js
那么它将按预期工作,但我需要得到它运行使用永远
这样就不会关闭,当我从服务器断开连接。
When running my app regularly using nodejs - nodejs init.js
then it works as expected, but i need to get it running using forever
so it won't shut down when i disconnect from the server.
编辑:
因为我有唯一的问题是,nodejs被关闭时,我关闭了终端会话到我的EC2服务器,我使用的Linux解决了这个的nohup
命令是这样的:的nohup须藤nodejs server.js&安培;
这一直nodejs在子进程中运行,即使我关闭终端窗口。
Edit :
Since the only problem i was having was that nodejs was closing when i closed the terminal session to my EC2 server, I solved this by using the linux nohup
command like this :nohup sudo nodejs server.js &
This kept nodejs running in a child process even after I closed the terminal window.
感谢您的帮助,但! :)
Thanks for the help though! :)
推荐答案
我还没有收到来自任何任何标准输出
输入永远
命令,这修复钉它:
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.
这篇关于nodejs'永远'只是没有做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!