用“咖啡”编译停止工作

Compiled with `coffee` stopped working

我不确定自己做了什么,但我无法再编译 CoffeeScript 文件。无论我尝试编译哪个文件,我都会不断收到以下信息。我尝试通过 运行 sudo npm remove --global coffeescript 然后 sudo npm install --global coffeescript 重新安装咖啡。使用 coffee-compile 包在 Atom 中自动编译仍然有效。我该如何解决?

user@computer:~/some/path $ coffee -c code.coffee 
/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:23
  ({spawn, exec} = require('child_process'));
   ^

ReferenceError: Invalid left-hand side in assignment
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/coffeescript/bin/coffee:15:5)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

在 Ubuntu 16.04.3 LTS 上得到了相同的结果,通过

简单地修复了
$ sudo npm remove --global coffeescript
$ sudo apt-get install coffeescript

您安装了 CoffeeScript 2+,需要 Node 6 或更高版本;但是您的 Node 运行时小于 6。(具体错误是 Node 运行时在 ({spawn, exec} = 解构语法上阻塞,Node < 6 无法理解。)安装 CoffeeScript 1.x 或 Node 6+ .