#Error after Astro update

3 messages · Page 1 of 1 (latest)

crimson thorn
#
 [vite] (ssr) Error when evaluating SSR module _astro\astro.config.mjs: Package subpath './jsx/renderer.js' is not defined by "exports" in _astro\node_modules\astro\package.json imported from _astro\node_modules\@astrojs\mdx\dist\index.js
      at exportsNotFound (node:internal/modules/esm/resolve:303:10)
      at packageExportsResolve (node:internal/modules/esm/resolve:650:9)
      at packageResolve (node:internal/modules/esm/resolve:836:14)
      at moduleResolve (node:internal/modules/esm/resolve:910:20)
      at defaultResolve (node:internal/modules/esm/resolve:1130:11)
      at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
      at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
      at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
      at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
      at link (node:internal/modules/esm/module_job:84:36)
[astro] Unable to load your Astro config

Package subpath './jsx/renderer.js' is not defined by "exports" in _astro\node_modules\astro\package.json imported from _astro\node_modules\@astrojs\mdx\dist\index.js
  Stack trace:
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageResolve (node:internal/modules/esm/resolve:836:14)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
chilly plumeBOT
#

Hi @crimson thorn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

This error appears to be related to an incompatibility between your Astro version and the @astrojs/mdx integration after an update. The error suggests that the MDX integration is trying to import a file that no longer exists in the new Astro version.

To resolve this issue, you need to update your @astrojs/mdx integration to the latest version compatible with Astro 5.0. Here's what you should do:

  1. Update @astrojs/mdx to the latest version (v4.0.0 or later) which is compatible with Astro 5.0. You can do this by running:

    npm install @astrojs/mdx@latest
    

    (Use pnpm or yarn instead of npm if that's your package manager)

  2. If you're using the MDX server renderer with the experimental Astro Container API, you need to update the import statement in your code. Change:

    import mdxRenderer from "astro/jsx/server.js";
    

    to:

    import mdxRenderer from "@astrojs/mdx/server.js";
    

These steps should resolve the error you're encountering. The changes are necessary because Astro 5.0 has moved the responsibility of handling and rendering JSX and MDX directly to the @astrojs/mdx package.

For more information about this change and other breaking changes in Astro 5.0, you can refer to the Upgrade to Astro v5 guide.

If you continue to experience issues after making these changes, you may need to check for other incompatibilities or consult the Astro documentation for further troubleshooting steps.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: