couchjs is a process invoked by couchdb to do the actual evaluation (e.g. run a map function that is implemented in javascript). It's an own OS process called by the couchdb main process communicating via stdin / stdout.
Hence, one way of debugging is tee-ing input and output. This should work on all platforms. I've tried on Windows (7) now with
- Couchdb in C:\Program Files (x86)\Apache Software Foundation\CouchDB (i.e. couchjs is C:\Program Files (x86)\Apache Software Foundation\CouchDB\bin\couchjs.exe)
- a UNIX-Shell installed (makes sense anyway, curl gets madness otherwise) via MINGW32 coming with Git at C:\Program Files (x86)\Git\ (i.e. sh.exe is C:\Program Files (x86)\Git\bin\sh.exe and all other tools are in C:\Program Files (x86)\Git\bin\ also)
- a globally writable C:\Temp
in default.ini (BACKUP REMINDER !!! - do a backup before you try the following!), one can now change the
[query_servers]
javascript = ./couchjs.exe ../share/couchdb/server/main.js
to
[query_servers]
javascript = ../../../Git/bin/sh.exe -c 'tee ../../../../Temp/couchin.trace | ./couchjs.exe ../share/couchdb/server/main.js | tee ../../../../Temp/couchout.trace'
(restart CouchDB)
This produces two files in C:\Temp which show exactly what's going on.
This is a tiny little bit hacky (OK, it's tremendously hacky) - but it can help see what's going on. Setup will not exactly become more stable, so one should really, really, really use this for debugging only.
Hope it helps ;-)