简体   繁体   English

node 和 nodemon 的区别

[英]Difference between node and nodemon

Will it make changes if I start a file by running nodemon index.js and not node index.js ?如果我通过运行nodemon index.js而不是node index.js启动文件,它会进行更改吗?

In Node.js, you need to restart the process to make changes take effect.在 Node.js 中,您需要重新启动进程才能使更改生效。 This adds an extra step to your workflow to have the changes take place.这为您的工作流程增加了一个额外的步骤来进行更改。 You can eliminate this extra step by using nodemon to restart the process automatically.您可以通过使用 nodemon 自动重新启动进程来消除这个额外的步骤。

Node needs to restart but makes changes take effect, and nodemon restarts the proccess automatically. Node 需要重新启动但会使更改生效,并且 nodemon 会自动重新启动进程。

I dont get this part, can someone explain this to me?我不明白这部分,有人可以向我解释一下吗? Does it mean nodemon restarts the proccess without crashing?这是否意味着 nodemon 在不崩溃的情况下重新启动进程?

When you launch your node.js application with Nodemon it will monitor for any changes and automatically restart the server, improving your productivity.当您使用 Nodemon 启动您的 node.js 应用程序时,它将监视任何更改并自动重新启动服务器,从而提高您的工作效率。

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Nodemon 是一个实用程序,它将监视源中的任何更改并自动重新启动服务器。

for example - I use nodemon when editing and developing on local server.例如 - 我在本地服务器上编辑和开发时使用 nodemon。 instead of canceling and restarting a server every-time you want to see the changes you have made, nodemon will automatically restart when you save your code.每次您想查看所做的更改时都不会取消并重新启动服务器,nodemon 会在您保存代码时自动重新启动。 I use atom, so, as soon as I hit "ctr + s" in atom to save, it will automatically restart the server.我使用atom,所以,只要我在atom中点击“ctr + s”进行保存,它就会自动重启服务器。 once I refresh the webpage the changes will be there.一旦我刷新网页,更改就会出现。 I have run into a few instances where I have had to restart my nodemon for changes to take effect, this usually only happens if I have added a lot with out saving in-between and multiple changes need to be applied.我遇到了一些必须重新启动 nodemon 才能使更改生效的实例,这通常只有在我添加了很多而没有中间保存并且需要应用多个更改时才会发生。

node is the standard command to use in node.js to run any javascript in the console. node 是在 node.js 中用于在控制台中运行任何 javascript 的标准命令。 when you run node index.js it will serve your app and thats it.当您运行 node index.js 时,它将为您的应用提供服务,仅此而已。 when you use nodemon index.js it will serve your app and listen for changes to the document/project and recompile, updating the output of localhost当您使用 nodemon index.js 时,它将为您的应用程序提供服务并监听对文档/项目的更改并重新编译,更新 localhost 的输出

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

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