【发布时间】:2012-05-16 12:53:58
【问题描述】:
当我在咖啡脚本交互模式下键入多行时,出现错误。
比如我想试试下面的代码:
kids =
brother:
name: "Max"
age: 11
sister:
name: "Ida"
age: 9
显示此错误:
coffee> kids =
Error: In repl, Parse error on line 1: Unexpected 'TERMINATOR'
at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
at /usr/lib/coffeescript/coffee-script.js:26:22
at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:309:12)
at Interface.write (readline:147:30)
at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
at Stream.emit (events:27:15)
我尝试使用'\'作为换行符,但显示相同的错误。
coffee> kids = \
Error: In repl, Parse error on line 1: Unexpected '\'
at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
at /usr/lib/coffeescript/coffee-script.js:26:22
at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:309:12)
at Interface.write (readline:147:30)
at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
at Stream.emit (events:27:15)
我不能使用多行,所以我不能使用缩进。
我该怎么办?
我的环境如下:
操作系统:Ubuntu 10.04 清醒
咖啡脚本版本 1.0.0 我用 PPA 和 apt-get 命令安装了 coffeescript。
查看此网址:https://launchpad.net/~gezakovacs/+archive/coffeescript
【问题讨论】:
-
我强烈建议单独安装 Node.js,然后使用
npm install -g coffee-script@1.3.1。这样一来,您就可以轻松安装所需的任何版本的 CoffeeScript,并在新版本可用时立即更新。 -
感谢您的评论。我将使用 ppa 的安装更改为使用 npm。
标签: coffeescript multiline interactive read-eval-print-loop