zoukankan      html  css  js  c++  java
  • Node.js and Forever “exited with code: 0”

    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.


  • 相关阅读:
    树莓派安装aria2轻松下载小资源
    利用树莓派3搭建可以发射无线局域网的微型服务器
    Vue语法
    redis-cluster集群
    分布式锁
    Redis--消息队列
    设计模式---享元模式
    设计模式(单例模式+原型模式)+ c#的内存分配机制
    MVC的ActionFilter
    MVC异常处理的7大场景 + MVC的异常处理的过滤器 + 全局异常
  • 原文地址:https://www.cnblogs.com/duyinqiang/p/5696458.html
Copyright © 2011-2022 走看看