incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Stott <nrst...@gmail.com>
Subject Re: Help with "compitation_error" an error on CouchDB 0.11.1 on Ubuntu 10.04 - CommonJS Module
Date Wed, 04 Aug 2010 05:18:23 GMT
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 <david@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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message