我运行的是 Ubuntu 13.04,安装后使用:
$ sudo npm install -g coffee-script
..带输出..
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0a3afa6a6a5a5edb3a3b2a9b0b480f1eef6eef3" rel="noreferrer noopener nofollow">[email protected]</a> /usr/local/lib/node_modules/coffee-script
任何命令都不会产生任何结果:
$ coffee js.coffee
$ coffee -v
$ coffee GiveMeSomeCoffeePlease
我确认它存在:
$ which coffee
/usr/local/bin/coffee
该文件有一些内容:
$ cat `which coffee`
#!/usr/bin/env node
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/coffee-script/command').run();
还尝试了可在我的笔记本电脑上运行的版本 1.6.1。不过在这台电脑上没有区别。有什么想法吗?
最佳答案
我终于找到了解决办法。我在 Ubuntu 上安装了 node
包,这是完全不同的:
Amateur Packet Radio Node program (transitional package) The existing node package has been renamed to ax25-node. This transitional package exists to ease the upgrade path for existing users.
我继续安装了 nodejs
包。但似乎它并没有完全创建正确的绑定(bind),我可以运行 nodejs
但不能运行 node
。所以我为它创建了一个别名,现在 CoffeeScript 运行得很好!
cd/usr/bin; sudo ln -s nodejs 节点
关于CoffeeScript:安装后无输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20327712/