编译“咖啡”停止工作

我不知道我做了什么,但我不能再编译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+,它需要节点6或更高版本; 但是你的节点运行时间是<6.(这个错误特别是Node节点运行时窒碍了({spawn, exec} = destructuring语法,Node <6不理解)。或者安装CoffeeScript 1.x或者节点6+ 。