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

Crawler is not a function #56

Open
atomixstar opened this issue Feb 14, 2019 · 3 comments
Open

Crawler is not a function #56

atomixstar opened this issue Feb 14, 2019 · 3 comments

Comments

@atomixstar
Copy link

atomixstar commented Feb 14, 2019

Hi, I am trying to setup a basic crawler script but I am getting an error:

new Crawler().configure({depth: 3}) ^ TypeError: Crawler is not a function at Object.<anonymous> (/var/www/user/test2.js:3:1) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3

test2.js

`var Crawler = require("js-crawler").default;

new Crawler().configure({depth: 3})
.crawl("http://www.google.com", function onSuccess(page) {
console.log(page.url);
});`

What I am doing wrong?

@AnthoniG
Copy link

AnthoniG commented Mar 5, 2019

Am getting the exact same thing. I am using Typescript as well, but still the same error message.

@imkimchi
Copy link

remove .default, you will be fine

@raquelmsmith
Copy link

I was getting TypeError: Crawler is not a constructor and removing .default worked for me 👍

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

4 participants