when using less.js i get the following error:
LESS error: Unable to load LessEngine., /path/to/my/file.less

on the configuration page it properly detects less.js and reports:
v2.5.3 Installed

although on the drupal status page it reports:
A LESS library was not detected. Please follow the instructions on the LESS project page to install the a LESS library.

lessc is working just fine, and executable by the user running apache. i also reverted to version 2.5.2 to see if it might be the new release but get the exact same error.

i am currently using less.php for now, which is working fine. i used npm to install, please let me know if there is anything i can do to help.

Comments

in0ni created an issue.

gassan’s picture

I got the same issue on my end (Ubuntu 14.04). Perhaps, you've skipped some step on the Less configuration.
I've installed less.js following the next steps:
1) Install Node.js: type in the terminal
sudo apt-get install nodejs
2)Install the Node package manager, npm:
sudo apt-get install npm
3) Create a symbolic link for node, Node.js tools use this name to execute.
sudo ln -s /usr/bin/nodejs /usr/bin/node
4) Install Less
npm install -g less
5) Once installed, you must select your engine on 'admin/config/development/less'.
It works for me. I hope this will help.

corey.aufang’s picture

Only thing I can think of is file permissions on the .less files somehow when running through a command line.

less.php is running in the same execution so it doesn't have any problems with access to the files.

Possibly since less.js is run through a command line call from php that it is somehow unable to process .less files.

When getting the version number for less.js it is also a command line call, so it's really weird that there are issues.

corey.aufang’s picture

One more thing, make sure that you installed less.js with the "-g" option so that it is installed globally.

The working directory is different from getting the version than from processing a .less file.

When processing a .less file, the working directory is set as the .less files folder for path inclusion purposes.

I don't remember off the top of my head the directory for the version call, but I'm guessing that it would be the Drupal root folder.

So if you installed less.js within the Drupal folder rather than global (-g) it might not be runnable from anywhere other than the Drupal root folder. I think.

in0ni’s picture

hey guys, thanks for the replies.

@gassan, i'm interested in what you did differently other than properly installing less.js to get this working right. i definitely have it installed properly as the following commands work just fine (even as the user running apache):

$ which lessc
/usr/bin/lessc

$ lessc --version
lessc 2.5.2 (Less Compiler) [JavaScript]

@corey.aufang, definitely installed using -g. as for file permissions goes, i assume all that is needed is read permissions since files are written to sites/default/files. currently read access to the entire project file structure is set to be readable by all users. furthermore if run lessc from the root of the file system to any of the less files that are reporting the error it works perfectly fine and outputs the complied css to stdout (lessc /home/user/path/to/the/file.less). i ran this both as myself and the apache user.

so i'm at a loss here. if i didn't understand, or missed something please let me know!

in0ni’s picture

seems i am definitely having some npm issues -- so i'll take a look and get back to you guys.

EDIT:
i was getting EACCES when trying to do something completely unrelated... but after fixing npm permissions, i'm still having this issue.

anthonys’s picture

Just in case anyone else is in the same position: for me it a quick fix - I had pushed the code to another server without setting the less engine to use on the less admin settings page. It probably won't solve a lot of people's issues, but it's worth checking the less_engine variable is set!