刷新node.js脚本! [英] Refresh node.js script!

查看:109
本文介绍了刷新node.js脚本!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从终端(mac)运行带有node.js的脚本,当我更改脚本时,我希望能够重新运行它而不必关闭并重新打开终端.这样吗?

I am running a script with node.js from the terminal (mac) and when I change my script I want to be able to rerun it without having to close and reopen terminal, Im a noob to mac and not sure how to do this?

谢谢

推荐答案

  • 您如何启动Node?您永远不必关闭终端窗口.至少,您应该能够键入 ctrl C 停止它,然后按向上箭头将node命令从命令历史记录中移回,或者键入命令!!,表示我运行的最后一个命令行",然后按回车键.

    • How are you starting Node? You should never have to close your terminal window. At the very least, you should be able to type ctrlC to stop it, then press the up arrow to bring the node command back from your command history, or type the command !!, which means "the last command line I ran", and hit the return key.

      或者,使用 node-dev .当文件在与节点脚本相同的目录中更改时,它将自动重新启动节点.您可以使用 npm 进行安装.然后,运行node-dev而不是node:

      Or, use node-dev. It automatically restarts node when files change in the same directory as your node script. You can install it with npm. Then, run node-dev instead of node:

      node-dev script.js

    • 这篇关于刷新node.js脚本!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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