如果您使用
JavaScript或编译的Coffee(coffee -c -m script.coffee)编写脚本,则使用
node-inspector调试节点应用程序非常简单.
但是,在使用coffeescript需要处理程序时:
require('coffee-script/register'); require('lib/component.coffee');
在脚本中我正在尝试使用node-debug进行调试,我得到:
(function (exports,require,module,__filename,__dirname) { # ^ SyntaxError: Unexpected token ILLEgal at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) ...
正好我需要的文件.
解决方法
当然是.我一直使用它,命令行看起来像这样:
node-inspector & coffee --nodejs --debug-brk ./scripts/mongoEtl.coffee node-inspector & mocha --compilers coffee:coffee-script ./test/dataLayer-test.coffee --ui bdd --debug-brk node-inspector --web-port=5870 & mocha --compilers coffee:coffee-script/register ./test/dataLayer-test.coffee --ui bdd --debug-brk=5880 -g 'my test name here'
我刚检查了最后一行,它正在工作,并且有coffeescript要求.然而,当我调试时,我实际上看到的是javascript,而不是咖啡.我不知道是否可以使用node-inspector运行和调试coffeescript(编辑:是的,它是,需要使用源映射,但这超出了这个答案的范围).我不相信它有价值 – 我认为能够很好地阅读javascript很好,所以我没有调查过它.
我认为您的问题可能在编译中,您是否尝试编译所需的文件?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。