Node . js应用程序不能调用未定义的方法
Node js Application cannot call method of undefined
我使用Crawler Ninja插件,在https://www.npmjs.com/package/crawler-ninja与插件过期域名相结合。https://github.com/christophebe/expired-domains.ninja
然而,在我的第一次"尝试",它返回了我一些模糊的错误。第一个应该是打字错误,我改了
console.log(ed.expireds.keys())
console.log(end.expireds.keys())
ERROR WAS:
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
问题:
不明白错误和如何修复它。如果需要更多的信息或细节,请评论。
CODE PLUGIN:
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
对象而不是ed
或end
。
说实话,我不知道图书馆,只是猜测。
as crawer -ninja-expired README说:'s ** work in progress **..
也,我已经阅读了源代码,没有expired()
或expired = {}
这样的东西
所以基本上你什么也做不了
相关文章:
- 骨干's Router.execute(callback,args,name)方法获取未定义的名称
- React路由器错误-'无法调用方法'getRouteAtDepth'的未定义'
- 使用javascript ajax post方法的未定义偏移PHP错误
- 在不兼容的接收器上调用的方法Set.prototype.add未定义
- PhoneGap无法调用未定义的方法loadurl
- jQuery验证器添加方法未定义
- Backbone中未定义的方法
- JS方法显示了未定义的简单示例
- TinyMCE验证给出错误:无法调用方法'getContent'的未定义
- 获取“;无法读取属性'[方法]'“未定义”;
- 续集返回未定义的模型自定义方法
- NoMethodError ('admin_application_path'的未定义方法)
- 理解modal.js中的未定义方法
- 带有base64的回形针:#<字符串:0xb46dba14>的未定义方法“stringify_keys”
- Rails 为 nil:NilClass 创建动作未定义方法 'each'
- 方法错误:未定义方法名称
- 在laravel 5.3中调用未定义方法IlluminateDatabaseQueryBuilder::attac
- addEventListener有无法解释的未定义方法错误
- 无法设置未定义方法的属性
- 带有ECMAScript6的JSHint:未定义方法