V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
talent
V2EX  ›  Node.js

每次在 ubuntu 上更新 node 代码后,都需要重启才有效?

  •  
  •   talent · 2014-09-02 19:41:49 +08:00 · 3688 次点击
    这是一个创建于 3525 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在ubuntu上用forever来启动node主程序,
    每次更新代码前,我都会用forever stop server.js来停止node,然后把代码更新后,再forever start server.js。
    我用了mongoose.js,一般做的修改就是对schema增加field。
    但每次用forever重启都没有效果,重启web server(apache)也没用,必须要把ubuntu重启后,node所做的更改才有效果。

    哪位哥们儿知道是怎么回事?
    6 条回复    2014-09-03 10:05:36 +08:00
    Livid
        1
    Livid  
    MOD
       2014-09-02 19:50:14 +08:00
    如果用 supervisor 启动的话,可以做到文件改了就自动重启了。

    npm install -g supervisor
    HerrDu
        2
    HerrDu  
       2014-09-02 20:32:33 +08:00
    今天尝试了楼上的建议,是可以自动修改的。
    talent
        3
    talent  
    OP
       2014-09-02 21:27:16 +08:00
    @Livid 好东西,明儿试试。

    另外,我遇到的问题是,重启node,程序还是没生效,必须重启ubuntu才生效,很奇怪。
    Livid
        4
    Livid  
    MOD
       2014-09-02 22:03:52 +08:00
    @talent 你的 node 是运行在 VirtualBox 里么?
    laoisaudi
        5
    laoisaudi  
       2014-09-03 09:43:59 +08:00
    的确用supervisord比较有效
    talent
        6
    talent  
    OP
       2014-09-03 10:05:36 +08:00
    @Livid Amazon的EC2
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2447 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 16:05 · PVG 00:05 · LAX 09:05 · JFK 12:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.