簡體   English   中英

Node js Application無法調用未定義的方法

[英]Node js Application cannot call method of undefined

我使用在https://www.npmjs.com/package/crawler-ninja中找到的Crawler Ninja插件與插件過期的域結合使用。 https://github.com/christophebe/expired-domains.ninja

但是,在我的第一次“嘗試”中,它返回了一些模糊的錯誤。 我相信是第一個錯字,我改了

console.log(ed.expireds.keys())

console.log(end.expireds.keys())

錯誤是:

console.log(ed.expireds.keys())
                ^
ReferenceError: ed is not defined

現在我面臨一個新的錯誤:

[root@vps-121706-2576 node_modules]# node ttt.js
Use log in : /root/plg/node_modules/logs/crawler.log
Well done Sir !, done in : 170389

/root/plg/node_modules/ttt.js:22
    console.log(end.expireds.keys())
                             ^
TypeError: Cannot call method 'keys' of undefined

題 :

不了解錯誤以及如何解決。 如果需要更多信息或詳細信息,請發表評論。

代碼插件:

var crawler     = require("crawler-ninja");
var ep          = require("crawler-ninja-expired");

crawl();

function crawl(){
var c = new crawler.Crawler({
    externalDomains : true,
    images : false,
    scripts : false,
    links : false, //link tags used for css, canonical, ...
    followRedirect : true
});

var expired = new ep.Plugin(c);

c.on("end", function() {

    var end = new Date();
    console.log("Well done Sir !, done in : " + (end - start));
    // the attributes expireds is a map with a key that match to the expired domains
    console.log(end.expireds.keys())



});

var start = new Date();
c.queue({url : "http://www.erijane.nl/"});
}

end是一個Date對象,沒有expireds屬性。

也許您只需要定義如下的expired對象:

var expired = new ep.Plugin(c);

或者也許您需要ep對象而不是edend

說實話,我不知道圖書館,只是猜測。

就像履帶忍者過期的自述文件所述:這是**正在進行中的**。

另外,我已經閱讀了源代碼,沒有諸如expired()expired = {}這樣的東西

所以基本上你無能為力:(

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM