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.

  • Sharad Singh


    When I check for the version with “lessc -v”, I get the error:

    “/usr/bin/env: nodejs: No such file or directory”

    Any idea how I should proceed next?

  • James Reimer

    fyi when i installed less on Ubuntu using node managed with nvm the change to the line from node to nodejs was uneccessary

  • Das Jott

    Brilliant! Thanks a lot, dude 🙂

  • Dusan

    I followed instructions and everything is working well. Thanks!

  • jhony

    I’m typing: lessc -v
    and the result is: bash: /usr/bin/lessc: No such file or directory

  • Pingback: Acta Eruditorium (I) - 2014-01-31 | Biko()

  • How about a less watcher. How do we install that?