2

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
coffee-script@1.6.3 /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?

mikabytes
  • 1,818
  • 2
  • 18
  • 30

2 Answers2

2

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

mikabytes
  • 1,818
  • 2
  • 18
  • 30
  • [Still true](http://packages.ubuntu.com/trusty/node) on Ubuntu 14.10. So I removed package `node` with `sudo apt-get purge node && sudo apt-get autoremove`, then installed the right stuff with `sudo apt-get install nodejs`, then the link with `cd /usr/local/bin; sudo ln -s /usr/bin/nodejs node`. (You switched your `ln` arguments accidentally.) – tanius Dec 21 '14 at 18:54
  • Yeah it's strange nobody's changed this so far, bet it's not an unusual mistake. I've edited my post to change order for the symbolic link creation, thanks. – mikabytes Dec 22 '14 at 20:45
  • Happens to me all. the. time. The least intuitive part of Linux. :P – tanius Dec 23 '14 at 04:27
0

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.

Mayur Rokade
  • 512
  • 7
  • 20