I have installed lessc via npm, Node.js Package Manager, and when I run lessc from terminal using
lessc /var/www/less/style.less /var/www/css/style.cssit works perfectly.
However, when I put this exact same command in a bash script, less.sh, it returns the error
lessc : command not found.
Also, I need to run this command from a bash script, because incron, a program which I am using to re-compile my less script each time they are modified, is unable to run the command mentioned above, which I believe may be caused by weird methods for handling white-space in the command.
3 Answers
npm install -g lessThat installs Less.js globally. Maybe you tried this already but it's not in the documentation on ; I had to ask around in #node.js on FreeNode.
1Where is the "lessc" executable? Do:
type -p lesscand take note of the directory, and figure out where that directory is added to your PATH. I think that bash and incron do not source your setup files (.bashrc, etc) the same way. Reading the Bash man page, the INVOCATION section describes how bash finds its startup files. A quick grep through the incron source shows that it doesn't mention .bashrc or .bash_profile.
You could change the "lessc" command in your script to:
/actual/path/to/lesscthat you found via
type -p lessc 1 in lubuntu:
$ type -p lessc
$ lessc
El programa «lessc» no está instalado. Puede instalarlo escribiendo:
sudo apt-get install node-less
$ sudo apt-get install node-less