Yep, just to confirm that, once again, the machine and CouchDB are completely blameless :) Lack of proper sleep and skim-reading the docs are my problem... got it working now. Thanks. David Pitman On Wed, Aug 4, 2010 at 3:39 PM, David Pitman wrote: > Sorry, just re-read the wiki docs at > http://wiki.apache.org/couchdb/CommonJS_Modules, looks like I > mis-understood how this works with the "exports" variable stuff too. Will > try again after I redo this design doc with a new (and hopefully correct) > understanding of how to use this feature actually works. > > Thanks for your help. > > David Pitman > > > > On Wed, Aug 4, 2010 at 3:18 PM, Nathan Stott wrote: > >> It's too difficult to read a raw design doc. Please post the JS module >> you're interested in. It's also a good idea to run your JS code through >> jslint. Ignore warnings about the "exports" variable being undefined. >> >> On Tue, Aug 3, 2010 at 10:13 PM, David Pitman >> wrote: >> >> > Hi there, >> > >> > I had some code working with the CommonJS Modules feature. It was >> > working just fine, and then after a few minutes it just stopped and >> > instead of "Hello World" I get this error message:--- >> > >> > {"error":"compilation_error","reason":"Module >> > require('html_head/doctype') raised error (new TypeError(\"func is >> > undefined\", \"/usr/local/share/couchdb/server/main.js\", 1106))"} >> > >> > --- >> > >> > My code is for this design document is: >> > >> > --- >> > >> > { >> > "_id": "_design/admin", >> > "_rev": "2-5454cb0680c2574703938cbccbf878ff", >> > "language": "javascript", >> > "html_head": { >> > "doctype": "> > Transitional//EN\" \" >> > >> http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd\ >> > ">", >> > "title": { >> > "add": "Add a New Comment", >> > "edit": "Edit an Existing Comment", >> > "view": "View an Entire Commentary", >> > "see": "See All Commentaries" >> > }, >> > "js": { >> > "jquery": "script type='text/javascript' src=' >> > http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js >> > '>", >> > "common": "", >> > "add": "", >> > "edit": "", >> > "view": "", >> > "see": "" >> > }, >> > "css": { >> > "common": "", >> > "add": "", >> > "edit": "", >> > "view": "", >> > "see": "" >> > } >> > }, >> > "html_body": { >> > "add": "" >> > }, >> > "views": { >> > "all": { >> > "map": "function(doc) {\n emit(null, doc);\n}" >> > } >> > }, >> > "shows": { >> > "add": "function(doc, req) {var responseObj = {}; >> > responseObj.code=200; responseObj.body = require('html_head/doctype') + >> > '' + require('html_head/title/add') + '' + >> > require('html_head/css/common') + require('html_head/css/add') + >> > require('html_head/js/jquery') + require('html_head/js/common') + >> > require('html_head/js/add') + '' + require('html_body/add') + >> > '';return responseObj}" >> > } >> > } >> > >> > --- >> > >> > I am not new to CouchDB, but am new to CommonJS stuff - is this a bug in >> my >> > code or a bug in CouchDB? >> > >> > Thank you to anyone who has any insight... >> > >> > David Pitman >> > >> > >