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. 高级UNIX环境编程2

    perror("error:") ;  strerror 日历时间:time_t (1970.1.1开始的秒数)     struct timeval (秒数和微秒)  struc ...

  2. Datamatrix码

    DataMatrix二维条码原名Datacode,由美国国际资料公司(International Data Matrix, 简称ID Matrix)於1989年发明.DataMatrix二维条码是一种 ...

  3. QT 强止杀进程

    bool KillProcess(QString ProcessName){  bool result = false; QString str1; HANDLE hSnapShot = Create ...

  4. Python基础 3----文件和网络

    1 Python文件IO 1 标转的输入和输出 print 方法:输出数据到标准的输出 raw_input 方法:标准的输入 2 file文件类 读文件 f = file(文件名, 模式) 有5种模式 ...

  5. hdu1533解题报告

    题意:这里有一个N*M的方格图.....图中m代表人,H代表房子...并且人数和房子的数量是相等的..那么.每个人可以竖直或者横向走一格,并且花费1S元...那么为了让所有的人进入房子,求解最小的花费 ...

  6. iOS 把图片从Mac本地添加到iOS Simulator中

    [把图片从Mac本地添加到iOS Simulator中] 1. 把图片从Mac本机拖动到iOS Simulator中: 2. iOS Simulator会自动打开Safari去打开对应的图片,然后你用 ...

  7. do -while语句的使用

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  8. html的头部标签详解

    <!DOCTYPE html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &q ...

  9. c/c++字符数组和字符串大揭秘

    第一:写这篇文章源于我对'\0'和“\0”的探讨 当我对char a []="\0"; int size_a=sizeof(a); //结果为2 当时我很纳闷字符串不是以'\0'结 ...

  10. 【转】CentOS 6.5 生产环境优化指南

    原文链接:https://www.deepwebcn.com/82.html centos6.5 CentOS 6.5 系统安装之后并不能立即投入生产环境使用,常常需要先经过我们运维人员的优化才行.优 ...