我不确定这是否纯粹是 Windows 问题。我没有选择在其他任何地方进行测试。鉴于这个非常简单的代码(Coffeescript):
console.log('Calling console.log')
console.error('Calling console.error')
console.log('Calling console.log second time - fails')
console.error('Calling console.error second time - fails')
nonexisting.throwError()
直接用coffee app.coffee
它运行它就可以了,我明白了:
Calling console.log
Calling console.error
Calling console.log second time - fails
Calling console.error second time - fails
ReferenceError: nonexisting is not defined
....
然而跑步nodemon app.coffee
给了我这个:
17 Mar 20:38:56 - [nodemon] starting `coffee.cmd server.coffee`
Calling console.log
Calling console.error
17 Mar 20:38:56 - [nodemon] app crashed - waiting for file changes before starting...
不仅根本没有异常信息,而且后来的日志消息也因为某种原因被吞掉了。在更复杂的情况下,我没有办法真正找到崩溃的原因。我尝试调试,但一切似乎都很好,调用了 console.log/error,但由于某种原因它没有显示。异常被 Coffeescript 捕获并直接发送到 stderr。
我想使用调试实用程序在控制台中的开发过程中获得很好的详细输出,并更容易找到问题。但有了这个麻烦制造者,这是不可能的。一旦发生未捕获的异常,我必须停止 nodemon 并手动运行整个程序以查找错误。解决方案的所有优雅都消失了:(
任何人都知道可能导致这种情况的原因以及是否有一些可能的解决方案?
Windows 7 64 位节点 0.10.26 Nodemon 1.0.15 Coffeescript 1.7.1