我正在尝试将 .coffee 文件编译为 .js 文件,但我不断收到此错误,我不知道出了什么问题,但提前感谢
C:\Documents and Settings\USER\Desktop\Bots\b>coffee
coffee> --bare -l --compile *.coffee
Error: In repl, Parse error on line 1: Unexpected '.'
at Object.parseError (C:\Documents and Settings\USER\Application Data\npm\no
de_modules\coffee-script\lib\coffee-script\parser.js:470:11)
at Object.parse (C:\Documents and Settings\USER\Application Data\npm\node_mo
dules\coffee-script\lib\coffee-script\parser.js:546:22)
at C:\Documents and Settings\USER\Application Data\npm\node_modules\coffee-s
cript\lib\coffee-script\coffee-script.js:40:22
at Object.eval (C:\Documents and Settings\USER\Application Data\npm\node_mod
ules\coffee-script\lib\coffee-script\coffee-script.js:123:10)
at Interface. (C:\Documents and Settings\USER\Application Data\np
m\node_modules\coffee-script\lib\coffee-script\repl.js:51:34)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream. (readline.js:82:12)
coffee>
最佳答案
我不太了解 CoffeScript,但在我看来,您正在尝试在交互式 shell 中提供命令行选项。尝试将选项作为参数给出:
C:\Documents and Settings\USER\Desktop\Bots\b>coffee --bare -l --compile *.coffee
关于javascript - Coffeescript 解析意外错误 '.',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8613575/