[英]Start server node.js with forever on ubuntu
I been searching alot and no result with same problem as me. 我一直在搜索,没有结果和我一样。 I have a Node.js application and I want to start it with
forever start app.js
, the process starts but no website found when i try in browser. 我有一个Node.js应用程序,我想使用
forever start app.js
来启动它,该过程已启动,但是在浏览器中尝试时找不到网站。 The process is in the list when I write forever list
. 当我写
forever list
时,该过程在forever list
。
Npm start
works fine but I cant use nodejs/node app.js or my_file.js.. It gives no error or something just new command line with no output in terminal. Npm start
可以正常工作,但是我不能使用nodejs / node app.js或my_file.js。它没有错误,也没有提供新的命令行,但在终端中没有输出。
So anyone know why I cant start the app with nodejs app.js
or forever start app.js
.. No files works. 因此,任何人都知道为什么我无法使用
nodejs app.js
启动应用程序,或者forever start app.js
无法forever start app.js
..没有文件起作用。
Thanks! 谢谢!
In express 4 you should write : 在快递4中,您应该写:
forever ./bin/www
And if you check your package.json
file you can see : 如果您检查
package.json
文件,则可以看到:
"scripts": {
"start": "node ./bin/www"
}
It's the npm start
script 这是
npm start
脚本
Alternatively, you can try using PM2 . 或者,您可以尝试使用PM2 。
It does a great job at keeping your app alive, and has some really useful features such as load balancing, no downtime, and a web interface to monitor your processes. 它在使您的应用程序保持活力方面做得很好,并且具有一些非常有用的功能,例如负载平衡,无停机时间以及用于监视流程的Web界面。
In addition, I find it dead simple to use. 另外,我发现它使用起来非常简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.