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. C++ 自定义结构体和类 内存对齐

    为什么要提出内存对齐? 比如这么一种处理器,它每次读写内存的时候都从某个8倍数的地址开始,一次读出或写入8个字节的数据,假如软件能保证double类型的数据都从8倍数地址开始,那么读或写一个doubl ...

  2. html里面自定义弹出窗口

    网页上默认的提示框或对话框一般比较丑,可以利用div遮盖层来自定义对话框 1.定义一个按钮或者链接(项目里面是通过点击一个图片) <img src="images/zz.gif&quo ...

  3. postgresql 忘记 postgres 密码

    参考博文: 如何重置postgresql用户密码 解决方法: 1.关闭数据库服务 2.进入数据库的工作空间目录 (如果是建库是没有另外指定,应该就是postgresql安装目录下的 data 目录) ...

  4. ThinkPHP文件上传类

    TP框架自带文件上传类使用: 类文件在ThinkPHP/Library/Think/默认在目录下 public function upload(){ $upload = new \Think\Uplo ...

  5. java 对象赋值问题

    import java.io.*; class CCircle{ private static double pi = 3.1415; private double radius; public CC ...

  6. 关于QuartusII对ram块的综合

    之前在看Altera的官方教程上就有说明,如果我们定义一个reg [`word_w]user_ram[`word_d]  ; QuartusII会自动综合成为一个ram—— 当然有一些前提:(后续补充 ...

  7. nginx使用小记

    中文wiki社区:http://wiki.codemongers.com/NginxChs 一 . nginx安装 1. 下载nginx : http://sysoev.ru/nginx/downlo ...

  8. 一步一步重写 CodeIgniter 框架 (10) —— 使用 CodeIgniter 类库(续)

    上一节简单实现了 CI 的类库扩展模型,所以 _ci_load_class 和 _ci_init_class 写的不是很完备.根据上节课的分析,当 system/libraries 目录下存在 Ema ...

  9. android——ListView功能的实现

    1.main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:a ...

  10. 下载并在Eclipse中关联Android源代码

    大家都知道文档写的好当然让人非常舒服,可是有时候文档再好也不如直接看源代码来的直接,既然Android是开源的,为什么不在eclipse里直接看它的源代码呢? 1.下载源代码 这部分网上有大量的资料, ...