You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by David Pitman <da...@thinktree.org> on 2010/08/04 05:13:31 UTC

Help with "compitation_error" an error on CouchDB 0.11.1 on Ubuntu 10.04 - CommonJS Module

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": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
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'></script>",
           "common": "<script type='text/javascript'></script>",
           "add": "<script type='text/javascript'></script>",
           "edit": "<script type='text/javascript'></script>",
           "view": "<script type='text/javascript'></script>",
           "see": "<script type='text/javascript'></script>"
       },
       "css": {
           "common": "<style type='text/css'></style>",
           "add": "<style type='text/css'></style>",
           "edit": "<style type='text/css'></style>",
           "view": "<style type='text/css'></style>",
           "see": "<style type='text/css'></style>"
       }
   },
   "html_body": {
       "add": "<body></body>"
   },
   "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') +
'<html><head><title>' + require('html_head/title/add') + '</title>' +
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') + '</head>' + require('html_body/add') +
'</html>';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

Re: Help with "compitation_error" an error on CouchDB 0.11.1 on Ubuntu 10.04 - CommonJS Module

Posted by David Pitman <da...@thinktree.org>.
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 <da...@thinktree.org> 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 <nr...@gmail.com> 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 <da...@thinktree.org>
>> 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": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
>> > Transitional//EN\" \"
>> >
>> http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd\<http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd%5C>
>> > ">",
>> >       "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
>> > '></script>",
>> >           "common": "<script type='text/javascript'></script>",
>> >           "add": "<script type='text/javascript'></script>",
>> >           "edit": "<script type='text/javascript'></script>",
>> >           "view": "<script type='text/javascript'></script>",
>> >           "see": "<script type='text/javascript'></script>"
>> >       },
>> >       "css": {
>> >           "common": "<style type='text/css'></style>",
>> >           "add": "<style type='text/css'></style>",
>> >           "edit": "<style type='text/css'></style>",
>> >           "view": "<style type='text/css'></style>",
>> >           "see": "<style type='text/css'></style>"
>> >       }
>> >   },
>> >   "html_body": {
>> >       "add": "<body></body>"
>> >   },
>> >   "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') +
>> > '<html><head><title>' + require('html_head/title/add') + '</title>' +
>> > 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') + '</head>' + require('html_body/add') +
>> > '</html>';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
>> >
>>
>
>

Re: Help with "compitation_error" an error on CouchDB 0.11.1 on Ubuntu 10.04 - CommonJS Module

Posted by David Pitman <da...@thinktree.org>.
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 <nr...@gmail.com> 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 <da...@thinktree.org> 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": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
> > 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
> > '></script>",
> >           "common": "<script type='text/javascript'></script>",
> >           "add": "<script type='text/javascript'></script>",
> >           "edit": "<script type='text/javascript'></script>",
> >           "view": "<script type='text/javascript'></script>",
> >           "see": "<script type='text/javascript'></script>"
> >       },
> >       "css": {
> >           "common": "<style type='text/css'></style>",
> >           "add": "<style type='text/css'></style>",
> >           "edit": "<style type='text/css'></style>",
> >           "view": "<style type='text/css'></style>",
> >           "see": "<style type='text/css'></style>"
> >       }
> >   },
> >   "html_body": {
> >       "add": "<body></body>"
> >   },
> >   "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') +
> > '<html><head><title>' + require('html_head/title/add') + '</title>' +
> > 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') + '</head>' + require('html_body/add') +
> > '</html>';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
> >
>

Re: Help with "compitation_error" an error on CouchDB 0.11.1 on Ubuntu 10.04 - CommonJS Module

Posted by Nathan Stott <nr...@gmail.com>.
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 <da...@thinktree.org> 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": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
> 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
> '></script>",
>           "common": "<script type='text/javascript'></script>",
>           "add": "<script type='text/javascript'></script>",
>           "edit": "<script type='text/javascript'></script>",
>           "view": "<script type='text/javascript'></script>",
>           "see": "<script type='text/javascript'></script>"
>       },
>       "css": {
>           "common": "<style type='text/css'></style>",
>           "add": "<style type='text/css'></style>",
>           "edit": "<style type='text/css'></style>",
>           "view": "<style type='text/css'></style>",
>           "see": "<style type='text/css'></style>"
>       }
>   },
>   "html_body": {
>       "add": "<body></body>"
>   },
>   "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') +
> '<html><head><title>' + require('html_head/title/add') + '</title>' +
> 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') + '</head>' + require('html_body/add') +
> '</html>';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
>