CoffeeScript: No output after installation

260 views Asked by At

I'm running Ubuntu 13.04, after installing using:

$ sudo npm install -g coffee-script

..with output..

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
[email protected] /usr/local/lib/node_modules/coffee-script

No commands yields any result, whatsoever:

$ coffee js.coffee 
$ coffee -v
$ coffee GiveMeSomeCoffeePlease

I verified that it exists:

$ which coffee 
/usr/local/bin/coffee

And the file has some contents:

$ 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();

Also tried version 1.6.1 which works on my laptop. No difference on this computer though. Any ideas?

2

There are 2 answers

3
mikabytes On BEST ANSWER

I finally found the solution. I had installed the package node on Ubuntu, which is something entirely different:

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.

I went ahead and installed the nodejs package. But seems it didn't quite create the right binding anyway, I could run nodejs but not node. So I made an alias for it and now CoffeeScript is running just fine!

cd /usr/bin; sudo ln -s nodejs node

0
Mayur Rokade On

Same here .. In my expressjs app, instead of running via

node app

now it seems I have to run it via

nodejs app

I ll either create an alias or a symlink like Mika did. I am using Ubuntu 13.10 fyi.