Using Asset Converter With Less Files

Hi all,

Trying to move to Yii2, i’m having a error, i think is not Yii specific but i don’t understand what i’m doing wrong.

I have nodejs installed and i can run lessc from windows dos box, if i run the command from the dos box actually it works and the file is compiled, when it runs through i get the following error.

Any help is appreciated. Thanks

Exception – yii\base\Exception

AssetConverter command 'lessc "D:/webserver/agenda/app/web/css/app.less" "D:/webserver/agenda/app/web/css/app.css" --no-color' failed with exit code 1:



'lessc' is not recognized as an internal or external command,

operable program or batch file.

Is the command available as lessc from anywhere i.e. added to PATH?

Yes that was the solution I forgot to add the path to windows system environment

Thank you

Can someone help - I’m trying to do the same thing (have read the docs, still struggling). I’m using WAMP (on windows) and I’m getting the same error above.

  1. How do I install lessc to my @app directory and where do I get it from?

  2. What do you mean by add it to environment variables?

Any help would be much appreciated - thanks.

  1. Use official less website. There are downloads and a guide.


Hi… i have same problem here.

I have added lessc to the system path. Run lessc in cmd from any directory, working good. I have also set the assetManager converter in config file (as in yii2 docs).

        'assetManager' => [

            'converter' => [

                'class' => 'yii\web\AssetConverter',

                'commands' => [

                    'less' => ['css', 'lessc {from} {to} --no-color'],




But when i try to load any page in yii2, it still give me error.

'lessc' is not recognized as an internal or external command,

operable program or batch file.

Am I missing something?

Restarting my computer, and Problem solved!

I have the same problem when using Sass pre-processor tools.

I also solved this problem by rebooting my computer. FYI

Windows 10 x64, php 7.0.8 x64 the same error.

From console or phpstorm runs perfectly, but php seems dont load path varible, and lessc.cmd run fails