问题描述
我在 Visual Studio Professional 13 上使用 Node,我很快意识到每次更改代码都要重新启动服务器变得很麻烦.
I was working with Node on Visual Studio Professional 13, and I soon realized that restarting my server for every change in code was becoming a hassle.
所以我做了一些研究,发现大多数人使用 nodemon 来自动刷新他们的服务器.虽然当我使用 VS 的界面生成我的 express 项目并下载 nodemon 时,在线教程使用命令行来安装和运行他们的服务器与 nodemon.
So I did some research and discovered that most people used the nodemon to automatically refresh their server. Although the tutorials online used command line to install and run their server with nodemon when I used VS's interface to generate my express project and download nodemon.
我的问题是当我运行我的服务器时,当我更新我的代码时服务器没有重新启动.我的问题是,如果我使用 VS 编码我的项目,如何通过 nodemon 运行我的服务器
My problem is that when I run my server, the server doesnt restart when I update my code. My question is how can run my server through nodemon if I am coding my project using VS
此链接也显示了与我有相同问题的人,但其中的解决方案并不那么清楚https://nodejstools.codeplex.com/workitem/545
this link also shows people with the same question as me, but the solution in it isn't that clearhttps://nodejstools.codeplex.com/workitem/545
推荐答案
以下对我有用:
打开您的项目属性(项目">您的应用属性...")
open your Project Properties ("PROJECT" > "YourApp Properties...")
将Node.exe路径"指向nodemon.cmd(点击右边的按钮在输入框的地址栏中输入%AppData%\npm\",显示所有文件,选择nodemon.cmd",保存属性表单)
point the "Node.exe path" to nodemon.cmd (click on the button rightof the input field, enter "%AppData%\npm\" in the adress bar, showall files, select "nodemon.cmd", save the properties form)
启动调试器,或使用启动而不调试"(Ctrl+F5)
start debugger, or use "start without debugging" (Ctrl+F5)
这篇关于如何在 NTVS(Visual Studio 节点工具)中使用 nodemon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!