withastro/astro

Getting error in starting blog template project - ShikiError: Language `(define name)` is not included in this bundle. You may want to load it from external source.

Closed this issue · 9 comments

prth commented

Astro Info

Astro                    v5.1.0
Node                     v22.12.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap
                         @astrojs/react
                         @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

  • Created new project with npm create astro@latest -- --add react --add tailwind
  • Used the option of blog template
  • And starting the project with npm run dev, the app seems to start, as there are following logs
image
  • But, on accessing the url http://localhost:4321/, on the browser there is a blank page, and there is following error in the terminal
12:03:51 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
ShikiError: Language `(define name)` is not included in this bundle. You may want to load it from external source.
    at resolveLang (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1874:17)
    at file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1891:52
    at Array.map (<anonymous>)
    at createHighlighter (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1891:41)
    at getSingletonHighlighter (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1914:16)
    at codeToHtml (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1938:27)
    at getViteErrorPayload (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/astro/dist/core/errors/dev/vite.js:88:48)
    at Timeout._onTimeout (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/astro/dist/vite-plugin-astro-server/response.js:19:67)
    at listOnTimeout (node:internal/timers:594:17)
    at process.processTimers (node:internal/timers:529:7)
  Hint:
    Make sure your promises all have an `await` or a `.catch()` handler.
  Error reference:
    https://docs.astro.build/en/reference/errors/unhandled-rejection/
  Stack trace:
    at resolveLang (file:///Users/prth/Box/projects/prth/try-astro-blog/node_modules/@shikijs/core/dist/index.mjs:1874:17)
    at Array.map (<anonymous>)
    [...] See full stack trace in the browser, or rerun with --verbose.

Also this error continually keeps happening, until I cancel the process

What's the expected result?

I was expecting the blog template based default app would render

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.
prth commented

I have not made any changes, the error is happening in trying to start with default state

prth commented

And, I tried the basic, minimal starter template option. This one is working properly.

I am also facing this issue. Tried upgrading mysite from 4.16.10 to 5.1.0.

Also tried 5.0.0, but the dev server got stuck in infinite loop.

Here is my code https://github.com/vkbansal/vkbansal.me/tree/astro-v5

Facing the same issue

Astro: v5.1.0
Node: v18.20.4
System: macOS (arm64)
Package Manager: pnpm
Adapter: none
Integrations: @astrojs/tailwind
Installation command: pnpm create astro@latest --add tailwind

The error occurs when I try to use import { Image } from "astro:assets"; inside .astro file, dev server got stuck in infinite loop.

I can reproduce this locally but not in Stackblitz. Interestingly, if I download the Stackblitz repo, install deps and run dev then it's fine, but if I delete the package lock and install then it fails. Makes me think this is a transitive dependency.

I can reproduce this with the default blog template and no extra integrations.

It seems to be the latest version of esbuild

This is evanw/esbuild#4010

There is a fix coming, but Vite is about to pin a fix: vitejs/vite#19027

Update to Astro 5.1.1 and this should work.