Search code examples
pythonnode.jslessodoo

Python3 Odoo TypeError sys.print is not a function


I've just set up a fresh install of Odoo (no custom addons/modules) and, after creating a database, i get this error on my main page:


The style compilation failed, see the error below. Your recent actions may be the cause, please try reverting the changes you made.

(b'', b'TypeError: sys.print is not a function
    at /usr/lib/nodejs/less/bin/lessc:384:25
    at tree.importVisitor.finish [as _finish] (/usr/lib/nodejs/less/lib/less/parser.js:669:28)
    at tree.importVisitor.run (/usr/lib/nodejs/less/lib/less/import-visitor.js:25:22)
    at Object.parse (/usr/lib/nodejs/less/lib/less/parser.js:675:22)
    at parseLessFile (/usr/lib/nodejs/less/bin/lessc:345:12)
    at Socket. (/usr/lib/nodejs/less/bin/lessc:407:9)
    at Socket.emit (events.js:228:7)
    at endReadableNT (_stream_readable.js:1185:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
')This error occured while compiling the bundle 'web.assets_common' containing:
    - /web/static/lib/bootstrap/less/variables.less
    ....

I've already tried, after some researches on Google:

  • Linking nodejs to node in /usr/bin

  • Reinstalling node-js, less-js, uglify-js

  • Reinstalling all pip3 Odoo requirements

  • Dropping my database after every try

  • Downgrading Less to 1.3.3

My versions:

NodeJs v12.14.1

Npm 6.13.4

[email protected]

[email protected]

It's not a common error as i see, and it's not well documented what to do in this case. Anyone has ever seen something similiar?


Solution

  • I recently had a similar error with Odoo 11 on Ubuntu 18.04, I had installed less with apt install node-less (which installs lessc 1.6.3). Installing less with npm install -g less instead (npm 6.13.4, nodejs 12.16.1, which installs lessc 3.11.1) made it work.

    What is strange is that you state that you already have lessc 3.11.1. Maybe try removing less completly and install it with npm.