CentOs 6.5 using root acount, I have a working Node.js Express app:

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”的更多相关文章

  1. [转]Node.js tutorial in Visual Studio Code

    本文转自:https://code.visualstudio.com/docs/nodejs/nodejs-tutorial Node.js tutorial in Visual Studio Cod ...

  2. php日志报错child exited with code 0 after seconds from start

    因为日志文件老是有这种提示: [27-May-2015 15:13:48] NOTICE: [pool www] child 3998 started [27-May-2015 15:13:59] N ...

  3. 转:Node.js邮件发送组件- Nodemailer 1.0发布

    原文来自于http://www.infoq.com/cn/news/2014/07/node.js-nodemailer1.0-publish Nodemailer是一个简单易用的Node.js邮件发 ...

  4. node.js 使用forever守护进程

    //forever的安装:npm install forever -g//使用forever启动守护进程:forever start 路径/your_app.js//关闭守护进程:forever st ...

  5. 【Visual Studio Code 】使用Visual Studio Code + Node.js搭建TypeScript开发环境

    1.准备工作 Node.js Node.js - Official Site Visual Studio Code Visual Studio Code - Official Site 安装Node. ...

  6. 使用Visual Studio Code + Node.js搭建TypeScript开发环境

    Visual Studio Code搭建Typescript开发环境 —— 相关文章: http://www.cnblogs.com/sunjie9606/p/5945540.html [注意:这里仅 ...

  7. Visual Studio Code - 调试 Node.js 代码

    官方的文档写的太好了!大家还是看参考资料吧. 参考资料: Debugging in Visual Studio Code Debug Node.js Apps using Visual Studio ...

  8. Node.js规范化应用

    Node.js运行在一个单线程模式,但它使用一个事件驱动范例来处理并发.它还有助于创建子进程,以充分利用并行处理的多核CPU系统. 子进程总是有三个流child.stdin,child.stdout和 ...

  9. Node.js快速入门

    Node.js是什么? Node.js是建立在谷歌Chrome的JavaScript引擎(V8引擎)的Web应用程序框架. 它的最新版本是:v0.12.7(在编写本教程时的版本).Node.js在官方 ...

随机推荐

  1. python学习之lambda匿名函数

    1 Python支持运行时使用“lambda”建立匿名函数(anonymous functions that are not bound to a name). python "lambda ...

  2. sortable.js 华丽丽的排序

    首先导入这几个资源 <link href="/css/jquery-ui-1.10.3.custom.css" rel="stylesheet" type ...

  3. Mylyn

    Mylyn(旧称Mylar)是eclipse的一个插件,用于将任务管理和上下文管理无缝集成到Eclipse中.1. 安装 下载相应的Mylyn zip包,解压缩开就是两个文件夹:features和pl ...

  4. MFC自绘控件学习总结第二贴---转

    首先感谢大家对第一帖的支持,应一些网友烈要求下面我在关于上一贴的一些补充和说明(老鸟可以无视)这一贴是实战+理论不知道第一帖的先看第一帖:http://topic.csdn.net/u/2011071 ...

  5. BZOJ 1618: [Usaco2008 Nov]Buying Hay 购买干草

    题目 1618: [Usaco2008 Nov]Buying Hay 购买干草 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 679  Solved:  ...

  6. Code(容斥,好题)

    Code Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submi ...

  7. PendingIntent.getBroadcast第四个参数flags

    (1) android.app.PendingIntent.FLAG_UPDATE_CURRENT 如果PendingIntent已经存在,保留它并且只替换它的extra数据. (2) android ...

  8. 【Web】java date 到 Oracle date 精确到时分秒

    有两种方法: java.util.Date startTime=new Date("2014/01/01 23:00:00"); 1.new Timestamp(startTime ...

  9. 自己新建Xib 和.h .m文件关联

    代理中注意点 1.新建MainViewController.h 和 MainViewController.m文件: 新建Main.xib文件: 2.拖View到Main.xib中: 3.点击File’ ...

  10. IPython在Windows 7上的搭建步骤

    安装篇 pip install jupyter 使用篇 启动本地notebook,打开Windows命令行,键入:ipython notebook