你可以在.coffee处理程序中使用Node Inspector吗?

如果使用JavaScript或编译的Coffee( coffee -c -m script.coffee )编写脚本,使用node-inspectordebugging节点应用程序非常简单。

但是,使用coffeescript require处理程序时:

  require('coffee-script/register'); require('lib/component.coffee'); 

在一个脚本我试图debugging使用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) ... 

正如我require的文件。

我正在尝试做什么? 我有几个CoffeeScript文件,我宁愿不必编译每次我想testing。

当然是。 我一直使用它,命令行看起来像这样:

 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要求。 但是,当我debugging我实际上看到JavaScript,而不是咖啡。 我不知道是否有可能使用node-inspector运行和debuggingcoffeescript(编辑:是的,它是使用源地图是必需的,但超出了这个答案的范围)。 我不相信它有价值 – 我认为能够很好地阅读javascript是很好的,所以我没有看到它。

我认为你的问题可能在编译,你有没有尝试编译所需的文件?