node -v 0.6.19. libxmljs. TypeError: Cannot read property 'prototype' of undefined

On Ubuntu 11.10, with node 0.6.17, 0.6.18 and 0.6.19 with installed libxml2 (2.7.8) and libxml2-dev - everything was working properly.

On FreeBSD server with node 0.6.19, libxml2 version 20708 (xmllint --version; xmllint: using libxml version 20708) it gives the following error message:

/home/pathtofile/www/node_modules/libxmljs/lib/element.js:24
Element.prototype = bindings.Element.prototype;
                                   ^
TypeError: Cannot read property 'prototype' of undefined
   at Object. (/home/pathtofile/www/node_modules/libxmljs/lib/element.js:24:37)
   at Module._compile (module.js:446:26)
   at Object..js (module.js:464:10)
   at Module.load (module.js:353:31)
   at Function._load (module.js:311:12)
   at Module.require (module.js:359:17)
   at require (module.js:375:17)
   at Object. (/home/pathtofile/www/node_modules/libxmljs/lib/document.js:3:15)
   at Module._compile (module.js:446:26)
   at Object..js (module.js:464:10)

add to your code before you call the xml objects:

var xml = require("libxmljs")