Monday, 22 May 2017

Node js App showing options is not defined

I am using the library broken-link-checker in my Node app to check for broken links. I am getting this error:

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

The following is my code for the node app.

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);

This is the npm package link: https://www.npmjs.com/package/broken-link-checker



via Stephen Paul Samynathan

No comments:

Post a Comment