1

after running odoo server and trying to go to localhost:8069 I got error in webpage saying "TypeError: CleanCSS is not a function".

I am running Odoo 9 on Ubuntu 16.04 enter image description here

karel
  • 122,292
  • 133
  • 301
  • 332
Mohamed Yousof
  • 141
  • 1
  • 6

2 Answers2

2

I got the same problem and I found this solution from https://github.com/odoo/odoo/issues/9113 by daniel-adb-fa, that worked fine and easy for me (I needed sudo because I was not logged as root):

  1. Install odoo 9.0 from the nightly repo according to documentation.

  2. Install the current versions of less and less-plugin-css via npm. This will install the versions to /usr/local/bin:

    sudo npm install -g less less-plugin-clean-css

  3. Install the symlink /usr/bin/node. This can be done manually, but you can also use an official apt-package for it:

    sudo apt install nodejs-legacy

  4. Now the link to lessc has to be patched to point to the version installed by npm instead of the (broken) distribution version:

    sudo rm /usr/bin/lessc sudo ln -s /usr/local/bin/lessc /usr/bin/lessc

  5. This should work, but an update of the distribution package might still break the patched link later. To avoid this, its possible to do:

    sudo apt-mark hold node-less

Then I restarted odoo service with:

sudo service odoo-server start

and don't forget to clear your browser cache after that.

Good luck!

1

Found solution on github

go to file /openerp/addons/base/ir/ir_qweb.py

in line 1685 which has the following code :

return [lessc, '-', '--clean-css','--no-js', '--no-color', '--include-path=%s' % lesspath]

remove item '--clean-css' from this list and save and everything will run correctly

https://github.com/odoo/odoo/issues/9113

Mohamed Yousof
  • 141
  • 1
  • 6