LESS CSS compilers returning blank

In Ubuntu and other distributions, you should prefer the distribution packages instead of manually installing packages. So, first of all, you should remove the recess installed via npm:

sudo npm uninstall recess -g

Also remove the node-less package installed via apt-get, so that we can start with a clean environment:

sudo apt-get remove node-less

After issuing these two commands, ensure that the following files do not exist, and if they exist delete them:

/usr/bin/lessc
/usr/local/bin/lessc

Also check the following directories (and remove them if they exist):

/node_modules/less
/usr/bin/node_modules/less
/usr/node_modules/less
/usr/local/bin/node_modules/less
/usr/local/node_modules/less
~/.node_modules/less
~/.node_libraries/less

All that files and directories may be generated in various ways. Different installation methods lead to different directories used. Removing all that files is important to ensure that nothing conflicts: you should always have one, and just one, version of a software installed on your system. The only exception is when the distribution itself provides different versions of the same software (in this case, package are made so that they don't conflict with each other).

Now you have a clean environment and can install node-less:

sudo apt-get install node-less

Note that the node-less package does not ship /usr/bin/recess, just /usr/bin/lessc, so it's perfectly OK if recess --compile fails (or, better, it must fail).

If lessc still does not work, please check the output of which lessc. Remember: if it does return something different than /usr/bin/lessc, it means that you are not using lessc from the distribution package, but something else.


After following the steps from Andrea's answer you may have to run source ~/.bashrc if you're getting bash: /usr/local/bin/lessc: No such file or directory when you run lessc and when which lessc shows /usr/bin/lessc. This is to update your $PATH environment variable.