Error mongoDB under Ubuntu – can’t find libmozjs.so

When installing MongoDB under Ubuntu, one could stumble upon the following problem:

mongo: error while loading shared libraries:
libmozjs.so: cannot open shared object file: No such file or directory

This is caused because MongoDB uses XulRunner for it’s operations. (This is also why you see a bunch of X11 programs that are to be installed when using apt-get). XulRunner, however, contains this file, but is not loaded.

Solving the problem:
Make sure you have xulrunner installed (sudo apt-get install xulrunner-1.9.2) and add its path to ldconfig’s configuration files, which are in/etc/ld.so.conf.d. You could create a file, say, /etc/ld.so.conf.d/xulrunner.conf, containing the following line:

/usr/lib/xulrunner-1.9.2.10/

After this, you chould run ldconfig (as root) and that should do the trick. Let me know if you have any problems with this.

2 Comments

  • Abhishek
    November 22, 2010 - 4:23 pm | Permalink

    Hello there,

    I tried making the file xulrunner.conf and running Mongo again but to no success.

    Any hint?

  • Abhishek
    November 22, 2010 - 4:47 pm | Permalink

    I found the workaround that btw,

    here it is: https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/557024

    Thanks for your effort!

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>