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

SyntaxError: The requested module 'cheerio' does not provide an export named 'default' #195

Closed
pierreguillot opened this issue Aug 12, 2024 · 6 comments

Comments

@pierreguillot
Copy link

I use mdpdf in Github Action on Ubuntu 22.04.4 LTS. I install mdpdf using npm install mdpdf -g and since yesterday, it generates an error:

file:///opt/hostedtoolcache/node/20.16.0/x64/lib/node_modules/mdpdf/src/utils.js:5
import cheerio from 'cheerio';
       ^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.16.0
...

Here is the full log.

It seems that the Cheerio dependency has been updated recently to v1.0.0 and this breaks mdpdf. How Cheerio must be imported and used has changed as announced in the release. This could be related to this issue cheeriojs/cheerio#3988.

@pgalbavy-itrs
Copy link

Same here, I have had to stop creating PDF docs from my MD for now. I am not a node/npm person, is there anyway to (easily) specify dependency versions and effectively rollback the dependency from latest to something that worked?

@elliotblackburn
Copy link
Owner

Hey, sorry about this - I don't use mdpdf too much myself so haven't come up against this yet. Yeah it looks like they release the official 1.0.0 which has caused problems. I don't have time for a full upgrade now, so I'll ping at the prior release candidate and look at pushing that out. Then if I, or someone else, gets a chance they can do the upgrade.

@elliotblackburn
Copy link
Owner

I've pinned the version and run it all locally and it seems to work just fine now. I've cut a release as 3.0.4 - if someone could confirm whether or not this works for them that would be much appreciated! Sorry for the issues on this one :(

@pgalbavy-itrs
Copy link

I can confirm that using:

npm install --verbose --global git+https://github.com/elliotblackburn/mdpdf.git#3.0.4

in my Dockerfile resolves the issue. Look forward to a full release.

Thanks!

@pierreguillot
Copy link
Author

Idem. The release 3.0.4 solves the problem. Here is the log. Thank you!

@elliotblackburn
Copy link
Owner

Great thanks both, I'll close this for now and at some point we can move it to 1.0.0 and do another release. Sorry for any pain this has caused you!

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

3 participants