在 Sublime Text 2 中重启/停止 nodejs 服务器? [英] Restart/stop a nodejs server within Sublime Text 2?

查看:49
本文介绍了在 Sublime Text 2 中重启/停止 nodejs 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Sublime Text 2 下载 nodejs 包 (https://github.com/tanepiper/SublimeText-Nodejs),但除了必须进入任务管理器并终止进程之外,我似乎找不到重启或停止服务器的方法.当使用插件提供的命令通过 node 运行文件时,它不会为您提供任何类型的命令窗口,因此 Ctrl+C 将不起作用.

I used Sublime Text 2 to download the nodejs package (https://github.com/tanepiper/SublimeText-Nodejs), but I can't seem to find a way that will restart or stop the server besides my having to go into the task manager and killing the process. When using the command provided by the plugin to run the file with node, it doesn't give you any kind of command window, so Ctrl+C won't work.

我发现了一些骇人听闻的做事方式,例如查找在特定端口上运行的进程的 .bat 文件,然后将其杀死.然后有几个 linux 命令对我没有好处,因为我在 Windows 上.

I've found a couple hackish way of doing things such as a .bat file that looks up the process running on a specific port, then killing it. Then there are a couple linux commands that don't benefit me since I'm on Windows.

我希望这里有人会看到这个并知道一个解决方案,我可以用它来轻松启动和停止节点服务器以进行开发.

I was hoping someone on here would see this and know a solution I could use to easily start and stop the node server for development.

推荐答案

我认为最适合您的解决方案是使用名为 Nodemon 的模块,它会在您每次在其中保存文件时重新启动您的节点服务器该项目.

I think the best solution for you here is to use a module called Nodemon which restarts your node server everytime you save a file inside the project.

https://github.com/remy/nodemon

这篇关于在 Sublime Text 2 中重启/停止 nodejs 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆