Node 0.5.10-pre 下抑制了 CoffeeScript 编译器错误
当我的脚本因任何原因无法解析时,我会从编译器获得堆栈跟踪,但根本无法了解脚本中问题所在的位置:
mpurvis@citadel:~/coffee$ coffee -c Test.coffee
/usr/local/lib/node_modules/coffee-script/lib/command.js:15
return process.binding('stdio').writeError(line + '\n');
^
Error: No such module
at /usr/local/lib/node_modules/coffee-script/lib/command.js:15:20
at /usr/local/lib/node_modules/coffee-script/lib/command.js:167:7
at /usr/local/lib/node_modules/coffee-script/lib/command.js:115:26
at [object Object].<anonymous> (fs.js:108:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1074:12)
at Object.wrapper [as oncomplete] (fs.js:246:17)
目前,它只是一个用于尝试系统的玩具脚本,因此我可以通常只是进行试验,直到它再次起作用,但这对于任何大小的文件都是不可能的。是否有一些我没有看到的技巧来获取发生错误的行?
谢谢!
When my script fails to parse for any reason, I get a stack trace from the compiler, with no insight at all into where in my script the problem lies:
mpurvis@citadel:~/coffee$ coffee -c Test.coffee
/usr/local/lib/node_modules/coffee-script/lib/command.js:15
return process.binding('stdio').writeError(line + '\n');
^
Error: No such module
at /usr/local/lib/node_modules/coffee-script/lib/command.js:15:20
at /usr/local/lib/node_modules/coffee-script/lib/command.js:167:7
at /usr/local/lib/node_modules/coffee-script/lib/command.js:115:26
at [object Object].<anonymous> (fs.js:108:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1074:12)
at Object.wrapper [as oncomplete] (fs.js:246:17)
For now, it's just a toy script to try the system out, so I can usually just experiment until it works again, but that would be impossible in a file of any size. Is there some trick I'm not seeing to get the line where the error occurred?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Node 的最新版本与 cs 不完全兼容..node_stdio 模块被删除...修复它的简单方法是打开 /usr/local/lib/node_modules/coffee-script/lib/command.js 并更改 第 15 行
process.binding('stdio').writeError(line + '\n'
的
process.stderr.write(line + '\n')
)总是可以从 github 问题部分获得更多帮助
https://github.com/jashkenas/coffee-script/commit/c77f7737a5d94a05a999109810ea7634f540e1e2
祝你好运,编码愉快
the latest version from node isn't full compatible with cs..the node_stdio module ws removed...a simple way for fix it is open /usr/local/lib/node_modules/coffee-script/lib/command.js and change the line 15
process.binding('stdio').writeError(line + '\n')
for
process.stderr.write(line + '\n')
always you can get more help from github issues section
https://github.com/jashkenas/coffee-script/commit/c77f7737a5d94a05a999109810ea7634f540e1e2
good luck and happy coding
这看起来不像语法问题。该错误来自
command.js
,它定义了coffee
命令行实用程序。如果是编译器错误,则可能来自于coffee-script.js
。那么为什么
command.js
中的process.binding('stdio')
位失败了呢?我能想到两种可能性:node -v
时你会得到什么?最安全的选择是最新的 0.4.x,因为它们是稳定版本(0.5.x 是实验性的)。This doesn't look like a syntax issue. The error is coming from
command.js
, which is what defines thecoffee
command-line utility. If it were a compiler error, it would be fromcoffee-script.js
.So why is the
process.binding('stdio')
bit incommand.js
failing? There are two possibilities I can think of:node -v
? Your safest bet is the latest 0.4.x, since those are stable releases (0.5.x is experimental).这个问题是很久以前的问题了。
Node 0.6.x 会抛出与 CoffeeScript 1.1.x 类似的错误;升级到 1.3.x 就可以了。
This question is from awhile back.
Node 0.6.x throws a similar error with CoffeeScript 1.1.x; upgrading to 1.3.x does the trick.
您的系统上可能有 2 个不同的咖啡脚本。检查哪种咖啡,然后找到较旧的咖啡并加冰。我去年夏天安装了一个(v1.1),现在一切都清理干净了。
Likely 2 different coffee-scripts on your system. check which coffee, than track down the older one and ice it. I had one from an install last summer (v1.1), it's all cleared up now.