Search code examples
lessyii2wampserver

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


So i normally work on external servers, but decided to set up a local environment in the form of WAMPserver on my windows 8.1 computer.

From (git bash) console, i can run lessc without a problem, but when i install Yii2, and attempt to process .less it says it can't find the command.

AssetConverter command 'lessc "C:/wamp/www/basic/web/css/site.less" "C:/wamp/www/basic/web/css/site.css" --no-color --source-map' failed with exit code 1:
STDOUT:

STDERR:
'lessc' is not recognized as an internal or external command,
operable program or batch file.

Now as far as i can tell, this should work. In fact, when i run that same command from console it works just fine. Am i missing a step here? Any help would be appreciated.


Solution

  • Ended up fixing it by changing the command to reference the lessc.cmd directly

    'assetManager'=>[
                'converter' => [
                    'class' => 'yii\web\AssetConverter',
                    'commands' => [
                        'less' => ['css', 'c:\path\to\lessc.cmd {from} {to} --no-color'],
                    ],
                ],
            ],
    

    Not to happy about the fix, because this means i will need to change my settings when i go 'live', but nothing else worked. I tried symlinking it into the yii directory, commands directory, etc.. but no good.