节点-v 0.6.19。 libxmljs。 TypeError:无法读取未定义的属性“原型”

在Ubuntu 11.10上,安装了libxml2(2.7.8)和libxml2-dev的节点为0.6.17,0.6.18和0.6.19,一切正常。

在节点为0.6.19的FreeBSD服务器上,使用libxml2版本20708(xmllint –version; xmllint:使用libxml版本20708),它会提供以下错误消息:

/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) 

在调用xml对象之前添加到您的代码中:

var xml = require("libxmljs")