2012-06-13 25 views
1

在Ubuntu 11.10上,使用安装了libxml2(2.7.8)和libxml2-dev的节点0.6.17,0.6.18和0.6.19 - 一切工作正常。node -v 0.6.19。 libxmljs。 TypeError:无法读取未定义的属性'prototype'

在FreeBSD服务器节点0.6.19,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) 
+0

您是否在Ubuntu上尝试了node v0.6.19?另外Ubuntu上的libxml2的特定版本是什么? – jsalonen

+0

是的,我在Ubuntu上试过并且所有的工作都一致。在FreeBSD和Ubuntu上我有libxml2的版本相同:2.7.8 – ZigZag

+0

我该怎么做才能重现错误?只需'npm install libxmljs'? – jsalonen

回答

1

添加到您的代码,你打电话之前xml对象:

var xml = require("libxmljs")

相关问题