Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LESS in Web Compiler for Visual Studio 2019 stopped to work

It worked for years. Yesterday for no reason (?) I'm not able to compile LESS files any more. I tried to

  • reinstall the Web Compiler extension,
  • reinstall Web Essentials 2019 extension,
  • reinstall the whole Visual Studio 2019 for 3 times,
  • start a new project from scratch

I do not know if some automatic update happened under the hoods, but basically, every time I try to compile a LESS file I get:

module.js:471
    throw err;
    ^

Error: Cannot find module 'C:\Users\igor\AppData\Local\Temp\WebCompiler1.12.394\node_modules\less\bin\lessc'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:505:3

Thanks for any help!

like image 624
Igor Avatar asked Jul 08 '20 09:07

Igor


People also ask

How do I compile less to CSS in Visual Studio?

css file nested under it in Solution Explorer after being enabled on the project. By default, compilation is off and that's indicated by a watermark at the bottom right corner of any LESS file. To enable LESS compilation, simply click the watermark and it changes to indicate LESS compilation is "on".


1 Answers

I deleted the C:\Users\<username>\AppData\Local\Temp\WebCompiler1.12.394 folder and ran the compilation from Task Runner Explorer which recreated the folder without having to reinstall Web Compiler.

Maybe it is related to also having the BuildWebCompiler 1.12.405 NuGet package installed in the project.

like image 96
Antonio Dlp Avatar answered Oct 23 '22 09:10

Antonio Dlp