Dataset importion problem
when using crawlee in a node.js project (npm i crawlee), I keep getting this error with my code :
(cheerio crawler, btw)
TypeError: Dataset is not a constructor
from this section in my scraper code:
const { CheerioCrawler } = require('crawlee');
const Dataset = require('crawlee').dataset;
i changed it from
import { CheerioCrawler, Dataset } from 'crawlee';
to
const { CheerioCrawler } = require('crawlee');
and tried moving the dataset too in its separate require statement but i'm getting this error
this is not in a my-crawler folder and not made with "npx crawlee create my-crawler"
this is node.js project that i downloaded the crawlee package to with "npm i crawlee"
is there something i need to change with the package.json or what's the problem?
2 Replies
absent-sapphire•3y ago
Any reason why you don't want to use the, import statement?
Although it will show you an error of "you can't use import outside of a module",
You can fix that by adding this line of code at the end of your package.json file,
"type" : "module"
vicious-goldOP•3y ago
thanks