Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options error #120

Closed
sbyinin opened this issue Oct 23, 2014 · 5 comments
Closed

options error #120

sbyinin opened this issue Oct 23, 2014 · 5 comments

Comments

@sbyinin
Copy link

sbyinin commented Oct 23, 2014

var Crawler = require("crawler");

var crawler = new Crawler();

crawler.queue([{
    uri: 'http://www.google.com',
    jquery: true,
    callback : function(error,result,$) {
        console.log(result.body);
        process.exit(0);
    }
}]);

throws

/Users/*/node_modules/crawler/lib/crawler.js:28
    if (typeof options.jquery !== 'undefined' && typeof options.jQuery === 'un
                      ^
TypeError: Cannot read property 'jquery' of undefined
    at checkJQueryNaming (/Users/*/node_modules/crawler/lib/crawler.js:28:23)
    at Crawler.init (/Users/*/node_modules/crawler/lib/crawler.js:39:15)
    at new Crawler (/Users/*/node_modules/crawler/lib/crawler.js:431:10)
    at Object.<anonymous> (/Users/*/node_modules/test.js:3:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

Process finished with exit code 8

options = undefined

@sbyinin
Copy link
Author

sbyinin commented Oct 23, 2014

0.3.0.

@ghost
Copy link

ghost commented Oct 23, 2014

Yep I confirmed this is a bug. Im fixing it now, already wrote a test to avoid this to happen again.

@sbyinin
Copy link
Author

sbyinin commented Oct 23, 2014

Thanks.

@ghost
Copy link

ghost commented Oct 23, 2014

This bug is caused because you are creating Crawler without any parameters:

var crawler = new Crawler();

A workaround for now is to do this:

var crawler = new Crawler({
    jquery: true,
    callback : function(error,result,$) {
        console.log(result.body);
        process.exit(0);
    }
});

crawler.queue('http://www.google.com');

ghost pushed a commit that referenced this issue Oct 23, 2014
when creating a crawler without any options cause the creation to fail
@ghost
Copy link

ghost commented Oct 23, 2014

Fixed in 0.3.1

@ghost ghost closed this as completed Oct 23, 2014
jasondeveloper-1099 added a commit to jasondeveloper-1099/Node-Crawler that referenced this issue May 20, 2022
when creating a crawler without any options cause the creation to fail
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant