2013-02-21 71 views
0

試圖下的NodeJS使用jsdom和接收此錯誤:的Node.js Jsdom返回[錯誤:插座掛斷]代碼: 'ECONNRESET'}

[錯誤:插座掛斷]代碼: 'ECONNRESET'}

使用的NodeJS v0.8.20的,Ubuntu 12.04

var jsdom = require("jsdom"); 
    jsdom.env({ 
        html: 'http://www.google.com', 
        scripts: ['http://code.jquery.com/jquery.js'], 
        done: function (errors, window) { console.log(errors); } 
    }); 

回答

0

這意味着對方意外關閉連接。

當我嘗試運行腳本,我得到這個:

/Users/isaacs/dev/js/x/node_modules/jsdom/lib/jsdom.js:178 
    features = JSON.parse(JSON.stringify(window.document.implementation._fea 
                 ^
TypeError: Cannot read property 'implementation' of undefined 
    at exports.env.exports.jsdom.env.processHTML (/Users/isaacs/dev/js/x/node_modules/jsdom/lib/jsdom.js:178:59) 
    at Request.exports.env.exports.jsdom.env [as _callback] (/Users/isaacs/dev/js/x/node_modules/jsdom/lib/jsdom.js:283:9) 
    at Request.init.self.callback (/Users/isaacs/dev/js/x/node_modules/jsdom/node_modules/request/main.js:127:22) 
    at Request.EventEmitter.emit (events.js:99:17) 
    at Request.<anonymous> (/Users/isaacs/dev/js/x/node_modules/jsdom/node_modules/request/main.js:767:16) 
    at Request.EventEmitter.emit (events.js:126:20) 
    at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (/Users/isaacs/dev/js/x/node_modules/jsdom/node_modules/request/main.js:729:14) 
    at IncomingMessage.EventEmitter.emit (events.js:126:20) 
    at IncomingMessage._emitEnd (http.js:366:10) 
    at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)