1

On my local osx setup, I have couchdb v1.0.2 installed. I wrote several script against this version all of which worked fine.

On my remote debian 6 server, I originally had couch v0.11.0 installed. Unfortunately, several of my scripts caused an Object.keys is not a function exceptions to be thrown. I figured v0.11.0 had an old version of javascript, so I upgraded to couch v1.1.0. I followed these instructions. After a bit of grief, I finally got v1.1.0 running, but the errors did not go a way. I'm still seeing Object.keys is not a function exceptions. I've confirmed that v1.1.0 of couch is installed by running couchdb -V and I've kill/restarted all instances of couch, beam, and erlang several times.

Any idea what's going on? I upgraded couch, but do I also have to upgrade the js engine separately? Are remnants of the v0.11.0 hidden somewhere? I used apt-get remove couchdb to uninstall v0.11.0. I had used apt-get to install it as well.

1 Answer 1

3

I do not think you have v0.11.0 remnants.

But you are correct: the "Javascript" in CouchDB is not built-in but rather linked into the system libjs or libmozjs.

I am unsure how to get a newer Spidermonkey version on OSX however many people (including me) use my Build CouchDB tool for exactly this purpose. It bundles its own Spidermonkey build which does have Object.keys, Array.isArray, and my favorite, [].reduce(). The CouchDB build will not be integrated into your OS deeply (ultimately, it just runs make install). But for the most part, on OSX and Linux it is as simple as running rake.

If you do try Build CouchDB, please report an issue in GitHub if you encounter any problems! I try to keep it as well-running as possible on current OSes.

3
  • Thanks for the help! Everything seemed to work when I used Build CouchDB. Unfortunately, I'm now seeing "reserved slot index out of range" every time I query against couchdb. Minimal repo: echo var a = 1 > test.js; ./couchjs test.js.
    – Xavi
    Oct 1, 2011 at 2:59
  • I figured out the problem. It turned out I had several versions of libmozjs installed (used dpkg -l | grep moz to find out). Once I removed used them using dpkg -r <package> the couchdb generated from build-couch started working correctly.
    – Xavi
    Oct 1, 2011 at 15:15
  • Awesome! Good luck with your project.
    – jhs
    Oct 1, 2011 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .