简体   繁体   English

从node.js运行“ node watch”命令时出错

[英]Error while running “node watch” command from node.js

I am trying to run "node watch" command for my project directory from node terminal. 我正在尝试从节点终端为我的项目目录运行“节点监视”命令。 It throws error saying "cannot find module "C:\\Users......\\watch". I also tried installing it using 它引发错误,提示“找不到模块“ C:\\ Users ...... \\ watch”。我也尝试使用安装

npm install node-watch.

But this does not help as well. 但这并没有帮助。

node-watch is not something you can run from the terminal. 您不能从终端运行node-watch It is a library that will watch for file changes and will trigger a callback when a change is detected. 它是一个库,它将监视文件更改,并在检测到更改时触发回调。

If you are trying to reload your nodejs program every time you change it, you should try something like `nodemon' . 如果您想在每次更改它时都重新加载它的nodejs程序,则应该尝试使用诸如`nodemon'之类的方法。 https://github.com/remy/nodemon https://github.com/remy/nodemon

To install it: npm install -g nodemon 要安装它: npm install -g nodemon

To run your app: nodemon myprogram.js 运行您的应用程序: nodemon myprogram.js

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

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