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

⚠️ Issue @astro/mdx keeps crushing due to rehype dependency #8399

Closed
MwirabuaTimothy opened this issue May 27, 2024 · 3 comments
Closed

Comments

@MwirabuaTimothy
Copy link

Every time I install @astro/mdx using the manual process I get the error below:

3:48:26 PM [vite] Error when evaluating SSR module site/astro.config.ts: failed to import "@astrojs/mdx"
|- Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'site/node_modules/astro/dist/jsx/rehype.js' imported from site/node_modules/@astrojs/mdx/dist/vite-plugin-mdx.js
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:326:11)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36)
[astro] Unable to load your Astro config

I have to use automatic way of npx astro add mdx plus I have to have rehype installed as a dev dependency otherwise I get the same error above.

@MwirabuaTimothy
Copy link
Author

Also whenever I add other remark plugins, @astro/mdx crushes with the same error.
So I have to first uninstall @astro/mdx and remove it from the astro.config.ts, complete adding and testing the other remark plugin, then come back and install @astro/mdx using the npx astro add mdx

@TheOtterlord
Copy link
Member

I'm not able to replicate this. Are you able to share your repo, or a minimal reproduction? I'll close this issue as it doesn't seem this isn't related to the docs. Feel free to continue discussing with me here, or join our Discord to share in our support channels.

@bartlomiejzuber
Copy link

Hey, we had same issue with our project. After investigation we've found out that the problem was on our side, we've added a mdx integration with:
pnpm astro add mdx

But we also had a line in .npmrc with:
strict-peer-dependencies=false

Which in result caused ignoring peerDependencies property on package.json, that in result pulled latest @astrojs/mdx which didn't work because we had an astro version set to 4.5.1.

If you have same issue either upgrade your astro to ^4.8.0 or downgrade @astrojs/mdx.

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