I’m getting a strange LESS compilation error, where the message is as follows:
non_object_property_callError: Cannot call method ‘charAt’ of null in
/Volumes/Windows/Program Files
(x86)/Ampps/www/custom-site/templates/custom-template/less/style.less:null:-1
1 @import “icomoon/icomoon.less”;
The code causing the error is as follows:
@import "imports/variables.less";
@import "icomoon/icomoon.less";
@import "mixins.less";
I tried compiling just these two files, and all goes well. So this told me that the error was in LESS’s ability to accurately report the source of errors. Testing on the nodejs compiler, the same error is returned. Testing on every other compiler still gives this error…
To try and find the source of the error, I naturally commented out the remaining code in the style.less file after the import call, but the error persisted. The issue here is that I have no idea where the error is, though I have a suspicion it’s somewhere after the call to the import.
Any help would be appreciated.
Saying “less is not able to report the exact problem” is actually only have of the truth.
What exactly happens is that the less compiler is not able to compile your less code because there is an issue in it, so the compiler triggers its error handling to show where the error is. However, doing so, an exceptions occurs. And thus, you see only the very same exception which is basically caused by a bug in the less compiler.
For a detailed description, see the pull request (https://github.com/cloudhead/less.js/pull/703) fixing the issue.
So, what are the options here:
Error sample of the less compiler: