简体   繁体   English

更改.js文件时,Node.js不重启服务器?

[英]Node.js don't restart server when changing .js files?

I'm currently using node-supervisor so that node picks up .js changes, it works good but I've noticed it restarts the server everytime I save a js file. 我目前正在使用node-supervisor,以便节点获取.js更改,它运行良好,但我注意到每次保存js文件时它都会重新启动服务器。 Is there a way to save a server-side .js file but not restart the server, yet have the changes automatically loaded into node? 有没有办法保存服务器端.js文件,但没有重新启动服务器,但是更改是否自动加载到节点? Ie, the process won't exit but somehow just update itself with the new changes. 即,该过程不会退出,但不知何故只是用新的更改来更新自己。

You cannot load code in in real-time because of the complications you would get (for example memory leaks) , But in theory you should be able to do this with modules. 您无法实时加载代码,因为您将获得并发症(例如内存泄漏) ,但理论上您应该能够使用模块执行此操作。

You could have a look at this: livenode , It is not recommended to use in production environment though 您可以看看这个: livenode ,但不建议在生产环境中使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM