flat-fuchsia•13mo ago
Error in crawlee import: `Module '"cheerio"' has no exported member 'Element'`
After running
npm run build
on version 3.11.1 of Crawlee, I get the error below:
I have seen other posts in channels here with the same issue, but there doesn't seem to be a known workaround or solution. Can anyone advise what has broken in the latest version? This error seems to be coming from the package itself, not from user code. I am not using any Cheerio crawling.5 Replies
Post created!
This post has been synced with the Apify community site and will be indexed by search engines
flat-fuchsiaOP•13mo ago
On further digging, it looks like this is due to the v1.0.0 release of Cheerio, which removed the ability to use (previously deprecated) imports. I have manually fixed the import in my node_modules, but this should be fixed asap (it's only 1 type that needs to be changed to
cheerio.Cheerio
instead of just Cheerio
after fixing the import statement.Thank you for your feedback, I will report this.
This is a known problem of Cheerio which will be addressed in a future Crawlee update by pinning the RC version of Cheerio and waiting for them to fix this. Crawlee beta already does this. Alternatively, you could use npm overrides to set the Cheerio version explicitly.
Crawlee 3.11.2 is out with the pinned version
ambitious-aqua•13mo ago
show me your
package.json
but probably the problem lies with how you install your packages (not taking packages from lock file but re-isntalling them - therefore updating dependecies of dependencies - happens a lot with Crawlee to be honest.
On their Github discussion was mentioned similar problem and their solution to that was to install with --force
flag(!))
add this to you package json
@cdslashflat-fuchsiaOP•13mo ago
Thanks, yeah I worked out the override and pinned the cheerio rc - I understand the beta versions of crawlee are pinning this version internally too