我在我的Node应用程序中使用库broken-link-checker来检查链接是否损坏。我收到了这个错误:
var htmlChecker = new blc.HtmlChecker(options, {
^
ReferenceError: options is not defined
at Object.<anonymous> (D:\nodejs\app.js:28:39)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
以下是我的节点应用程序代码。
var blc = require('broken-link-checker');
var htmlChecker = new blc.HtmlChecker(options, {
html: function(tree, robots){},
junk: function(result){},
link: function(result){},
complete: function(){}
});
var html = "http://specflux.com";
var baseUrl = "http://specflux.com";
htmlChecker.scan(html, baseUrl);
答案 0 :(得分:1)
您只需配置您的选项变量或将其留空:
let options = {};
var htmlChecker = new blc.HtmlChecker(options, {
...