It appears that Fs.watchfile is not supported on Windows platforms. I didn't want to use IIS NODE, so I spent a little time writing a little tool to help with debugging.
This tool can do:
Monitor changes to all subdirectories related files under the main JS file. Restart node process with changes
The log can be exported to this tool for easy viewing in the browser.
usage:
NodeWatcher.exe Main.js
All parameters:
Copy Code code as follows:
NodeWatcher.exe main JS program [other optional parameters]
The main JS program must be specified. Equivalent to node main JS program
-r: [true | false] automatically restarts when an error occurs (the node process exits).
Example: Nodewatcher.exe-r false
-E: Files for which suffix names are monitored in the monitored directory. JS and node by default
Example: Nodewatcher.exe-w lib-e js-e node-e json-e Config
-?:
-help: Displaying Help documents
Log output to view Web pages
http://localhost:2012/
The following figure:
Node.js to the tool output log, you can use the Console.log series statements can also invoke the method provided by the tool.
tools provided by:
1 Download Http://localhost:2012/logger.js to the root directory of the project
2 reference require ("./logger.js")
3 Call:
Logger.log (...)
Logger.error ()
Logger.info ()
Logger.warn ()
Logger.exception (e)
The argument can be a string or an object, and if it is an object, it will output its first-level attribute.
Installation:
You don't need to install it, but you have a. Net framework on your computer. I was compiled with 2.0. It's OK to download the NodeWatcher.exe and put it in the directory.
Download Address: NodeWatcher_jb51.net.rar