You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Odoo 9中无法执行lessc命令的问题

Fixing 'lessc' Command Not Found Error in Odoo 9 (Windows)

Hey there, let's work through this frustrating 'lessc' not found issue you're hitting with Odoo 9 on Windows. I've troubleshooted similar problems for other users, so here are actionable steps to get things working:

1. Verify System PATH Includes Node.js and Global npm Directories

Windows often fails to recognize global npm commands if their paths aren't in the system environment variables. Here's how to check and fix it:

  • Right-click This PC → Properties → Advanced System Settings → Environment Variables.
  • In the System Variables section, look for the Path variable.
  • Ensure it includes:
    • Your Node.js installation folder (typically C:\Program Files\nodejs\)
    • The global npm packages folder (usually C:\Users\[YourUsername]\AppData\Roaming\npm)
  • If either path is missing, click Edit and add them. Then restart your command prompt (or even your PC) to apply changes.

2. Reinstall Less Globally with Admin Rights

Sometimes the initial global install fails silently due to permission issues. Let's reset it:

  • Open Command Prompt as Administrator (right-click Command Prompt → Run as administrator).
  • Uninstall the existing Less package:
    npm uninstall -g less
    
  • Reinstall a version compatible with Odoo 9 (newer versions might cause conflicts):
    npm install -g less@2.7.3
    
  • Test if lessc works by running:
    lessc -v
    
    You should see the version number printed if the install was successful.

3. Specify the Full Path to lessc in Odoo's Configuration

Odoo might not locate lessc automatically on Windows. Update your Odoo config file (usually odoo.conf) to point directly to the lessc.cmd file:

  • Open odoo.conf in a text editor.
  • Look for the lessc line (add it if it doesn't exist) and set it to:
    lessc = "C:\Users\[YourUsername]\AppData\Roaming\npm\lessc.cmd"
    
    Replace [YourUsername] with your actual Windows username.

4. Restart Odoo and Clear Browser Cache

Changes to environment variables or config files won't take effect until you restart services:

  • Close the Odoo server window completely, then restart it.
  • In your browser, clear the cache (press Ctrl+Shift+Del, select "Cached images and files", then click "Clear data").
  • Refresh the Odoo page and check if the error is gone.

5. Check Node.js Version Compatibility

Odoo 9 is an older version, so it might not play well with the latest Node.js releases. If the above steps don't work, try downgrading Node.js to a compatible version like 12.x or 14.x (LTS versions are safest). You can use nvm-windows to switch between Node.js versions easily without uninstalling anything.


内容的提问来源于stack exchange,提问作者Dhouha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:34:09