Windows环境下Odoo 10安装报错:could not execute command 'lessc' 求助
Hey there, I’ve dealt with this exact issue on Windows before—let’s get it sorted out step by step. The error pops up because Odoo relies on the lessc compiler (part of the LESS CSS preprocessor) to render styles, but it can’t locate the command in your system’s PATH. Here’s how to fix it:
First, install Node.js
lesscis a Node.js package, so you’ll need Node installed first. Grab the LTS version (the most stable pick for Odoo 10) from the official Node.js site. When going through the installer, make sure to check the box labeled "Add to PATH"—this is critical for your system to find Node and its tools later.Install the
lesspackage globally
Open Command Prompt (CMD) or PowerShell (you don’t need admin rights unless you hit permission snags), then run this command:npm install -g lessThe
-gflag installs it system-wide, solesscwill be accessible anywhere on your machine.Verify the installation
Stay in your terminal and run:lessc -vIf you see a version number show up, you’re good to go—
lesscis now installed and detectable.Restart Odoo
Changes to your system’s PATH won’t take effect in already running programs. Close your Odoo server window completely, then fire it up again. The error should be gone at this point.If it still doesn’t work: Check your PATH manually
Sometimes the Node installer misses adding necessary paths to your system PATH. Here’s how to fix that:- Right-click This PC → Properties → Advanced system settings → Environment Variables.
- Under System Variables, find the
Pathvariable and click Edit. - Make sure these two paths are listed (replace
[YourUsername]with your actual Windows username):C:\Program Files\nodejs\C:\Users\[YourUsername]\AppData\Roaming\npm\
- If either is missing, add them, click OK to save all changes, then restart your computer and try Odoo again.
Bonus: Use a compatible less version
If you run into odd styling issues even after fixing the error, Odoo 10 works best withlessversion 2.7.3. Install that specific version with:npm install -g less@2.7.3
内容的提问来源于stack exchange,提问作者Ffs

