Node.js and Forever “exited with code: 0”
2015-12-26 23:54
615 查看
CentOs 6.5 using root acount, I have a working Node.js Express app:
The app can be seen working on the internet browser. I stop the app and try to run it with forever:
Throws a couple of warnings that should not be a problem and looks like it should be working but its not showing on the browser, forever list:
If I check OkGm.log:
Why is the app not working when I run it with forever?
Ok I found out what was happening. I was trying to run:
When this Express app must be started with:
There was no useful info on internet when searching for this by the error log output ("exited with code: 0"), so I hope this answer helps begginers like me in what I think can be an easy mistake to make.
root@vps [/home/test/node]# npm start app.js > test@0.0.1 start /home/test/node > node ./bin/www app.js
The app can be seen working on the internet browser. I stop the app and try to run it with forever:
root@vps [/home/test/node]# forever start app.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: app.js root@vps [/home/test/node]#
Throws a couple of warnings that should not be a problem and looks like it should be working but its not showing on the browser, forever list:
root@vps [/home/test/node]# forever list info: Forever processes running data: uid command script forever pid id logfile uptime data: [0] OkGm /usr/local/bin/node app.js 32222 32227 /root/.forever/OkGm.log STOPPED root@vps [/home/test/node]#
If I check OkGm.log:
error: Forever detected script exited with code: 0
Why is the app not working when I run it with forever?
Ok I found out what was happening. I was trying to run:
forever start app.js
When this Express app must be started with:
forever start ./bin/www
There was no useful info on internet when searching for this by the error log output ("exited with code: 0"), so I hope this answer helps begginers like me in what I think can be an easy mistake to make.
相关文章推荐
- Node.js and Forever “exited with code: 0”
- 填坑系列: nodejs后台在支付宝异步通知时获取到的参数为空(使用koa模块)
- leetcode:19 Remove Nth Node From End of List-每日编程第三十六题
- Ubuntu14.04 快速配置 nodejs
- [Node.js] node-persist: localStorage on the server
- rabbitmq php pub nodejs sub
- 读书笔记之-node入门
- Web平台能从Node.js学到什么
- leetCode24:Swap Nodes in Pairs
- Nodejs框架演进之路
- Json 与 JsonNode 转换
- leetcode刷题日记——Remove Nth Node From End of List
- windows 下搭建 nodejs集成环境
- nodejs的某些api~(一)node的流2
- lnode满,维护记录
- node.js 调用 mongoose 的 aggregate 函数
- node学习笔记
- 【实践】express搭建nodeJS中间层(三)
- nodejs - multer模块教程,使用multer进行附件上传
- NameNode HA配置详解