cloudhead/less.js — Issue #592: lessc compile error "Cannot call method 'charAt' of undefined"
Author: philipp-spiess
Created: 2012-01-23 19:24:30+00:00
State: open

Hi,

When trying to compile Twitter's bootstrap via lessc, i found out this very strange behavior.

When i'm compiling within bootstrap's directory, everything works fine:

$ cd bootstrap && lessc bootstrap.less

But when i go up one folder, it looks like

$ cd ../ && lessc bootstrap/bootstrap.less
TypeError: Cannot call method 'charAt' of undefined
at getLocation (/usr/lib/node_modules/less/lib/less/parser.js:204:34)
at new LessError (/usr/lib/node_modules/less/lib/less/parser.js:213:19)
at Object.toCSS (/usr/lib/node_modules/less/lib/less/parser.js:379:31)
at /usr/lib/node_modules/less/bin/lessc:103:28
at /usr/lib/node_modules/less/lib/less/parser.js:428:40
at /usr/lib/node_modules/less/lib/less/parser.js:94:48
at /usr/lib/node_modules/less/lib/less/index.js:113:15
at Object.parse (/usr/lib/node_modules/less/lib/less/parser.js:430:17)
at /usr/lib/node_modules/less/lib/less/index.js:112:14
at [object Object]. (fs.js:107:5)

Why i need this? I've included bootstrap to my project via `@import`. This inclusion file is one dir above bootstrap.less. So when i'm compiling my inclusion file, it gives me the very same error.

Additional:

$ lessc -v
lessc 1.2.1 (LESS Compiler) [JavaScript]
$ uname -a
Linux gamboo.at 2.6.32-4-pve #1 SMP Mon May 9 12:59:57 CEST 2011 x86_64 GNU/Linux

I hope someone can reproduce this error.

Some additional information:

- I'm running Debian
- Inclusion via browser works great
- Stable v1.4.0 of Twitter's bootstrap in the same procedure also works great

And another intressing part:

When cd-ing to bootstrap/ and building via `lessc ../include.less` everything works fine :D