Install LESS on Ubuntu with npm


LESS is available on Ubuntu repositories as “node-less” package. However, as of writing this post, it is an old version (1.3.1) which contains lots of bugs, while a newer and more stable one (1.3.3) is available. And you can install latest LESS version with npm:

sudo apt-get install npm
sudo npm install -g less

Because the command name of the node.js is nodejs (instead of node) on Ubuntu, when the installation is complete, you need to change this first line of lessc command. Open /usr/local/bin/lessc with your favorite text editor (with root privileges), and change the end of the first line from node to nodejs.

--- lessc.old	2013-05-21 13:50:00 +0300
+++ lessc	2013-05-21 13:51:00 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/env nodejs
 
 var path = require('path'),
     fs = require('fs'),

After saving the file, you can test if lessc command is available, and the correct version is installed.

which lessc
lessc -v

If you have any trouble, you can ask me on the comment section below.

,