Unfortunately the current CoffeeScript package is for an old version. Thus, some manual work is needed to get the latest version working for you on Ubuntu. Here are the steps, we need to install Git, node.js, npm and finally CoffeeScript:
$ sudo apt-get update # Install needed packages $ sudo apt-get install git-core curl build-essential openssl libssl-dev # Install node.js $ git clone https://github.com/joyent/node.git && cd node $ ./configure $ make $ sudo make install $ cd # Install npm $ curl http://npmjs.org/install.sh | sudo sh #Install CoffeeScript $ sudo npm install -g coffee-script
Now give it a shot:
$ coffee -i coffee> square = (x) -> x * x [Function] coffee> square 5 25


Thanks, that was helpful,
I am new to Linux & Ubuntu, followed the steps and coffee script was installed.
looking forward to read more about how to actually use coffee script and generate java script.
Regards
I’m using coffeescript at work now, and we used your tutorial for installing because the Ubuntu repo’s are behind the times and the PPA’s we found for it didn’t seem to have their packages built properly.
Also, the vim plugin by kchmck is essential to working with coffeescript.
I really hope CoffeeScript catches on because it’s so much better to work with than just plain old Javascript.
Cheers
Thanks, very helpful, but I’ve found that being on the bleeding edge of node.js can cause problems (like the hang reported here http://stackoverflow.com/questions/6985457/cant-install-coffeescript-on-ubuntu-lts). Downgrading to the latest stable fixed the hang for me, just had to run this after the “git clone” and before the “./configure”
git checkout v0.4.10
[...] Installing CoffeeScript on Ubuntu [...]
[...] Professional, cheap & fast PHP, CGI/Perl script installation & secure file transfer services, with fast delivery of services within 24 hours & at affordable prices. Read More… [...]
Installing NPM failed with the command your provied:
curl http://npmjs.org/install.sh | sudo sh
If you used https instead of http it works fine.
curl https://npmjs.org/install.sh | sudo sh
Thanks for the instruction!
Thanks. Very useful.
[...] More [...]