KoalaGangsta
KoalaGangsta

Reputation: 556

Less (lessc) does not work on a new System. ([TypeError: undefined is not a function])

I have set up my new development environment with Windows 10 and I am facing a problem regarding less.

I have installed less like explained on lesscss.org using

npm install -g less

The installer runs fine and does not throw any errors.

Now I try to compile a .less file in the command line like this:

lessc input.less output.css

and I get following error:

[TypeError: undefined is not a function]

I have tried reinstalling less and npm but nothing has working. Compiling the same file on my old system works fine. It seems like some installed runtime environment on my new machine has an error which results in lessc calling an undefined function somewhere.

What is the best way to find and fix the error?

Upvotes: 1

Views: 641

Answers (1)

aayush tyagi
aayush tyagi

Reputation: 11

You can solve it in two ways: Provide a path of lessc to your Environment Variables PATH will be something like this C:\Users\aayus\AppData\Roaming\npm\node_modules\less\bin\lessc After it run lessc input.less output.css

Also what you can do is while compiling provide a full path to your lessc compiler

C:\Users\aayus\AppData\Roaming\npm\node_modules\less\bin\lessc styles.less styles.css

If both of these are not working the best way is to use Online compiler Here is link to one: http://beautifytools.com/less-compiler.php Paste your less code and click on Compile less

Upvotes: 1

Related Questions