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

Default installation doesn't work with bun due to locale issues #1986

Closed
1 task
aaronmondal opened this issue Jun 8, 2024 · 2 comments
Closed
1 task

Default installation doesn't work with bun due to locale issues #1986

aaronmondal opened this issue Jun 8, 2024 · 2 comments

Comments

@aaronmondal
Copy link
Contributor

What version of starlight are you using?

0.24.0

What version of astro are you using?

4.10.1

What package manager are you using?

bun (1.1.12)

What operating system are you using?

Linux

What browser are you using?

Chrome

Describe the Bug

It looks like the recent changes to i18n in 0.24.0 broke running with Bun. Version 0.23.4 works fine.

To reproduce:

npm create astro@latest -- --template starlight
cd <path-to-project>
bun install
bun run dev
bun run dev
$ astro dev
11:29:46 PM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/utils/i18n.ts:
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

11:29:46 PM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/shared/localeToLang.ts: failed to import "/node_modules/@astrojs/starlight/u
tils/i18n.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

11:29:46 PM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/expressive-code/translations.ts: failed to import "/node_modules/@astrojs/st
arlight/integrations/shared/localeToLang.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

11:29:46 PM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/integrations/expressive-code/index.ts: failed to import "/node_modules/@astrojs/starlight
/integrations/expressive-code/translations.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

11:29:46 PM [vite] Error when evaluating SSR module /node_modules/@astrojs/starlight/index.ts: failed to import "/node_modules/@astrojs/starlight/integrations/expressive-code
/index.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

11:29:46 PM [vite] Error when evaluating SSR module /home/xxx/docs/astro.config.mjs: failed to import "/node_modules/@astrojs/starlight/index.ts"
|- AstroUserError: Failed to get locale informations for the 'en' locale.
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at getLocaleInfo (:99:47)
    at <anonymous> (:5:48)
    at processTicksAndRejections (:12:39)

[astro] Unable to load your Astro config

[AstroUserError] Failed to get locale informations for the 'en' locale.
  Hint:
    Make sure to provide a valid BCP-47 tags (e.g. en, ar, or zh-CN).
  Stack trace:
    at new AstroUserError (/home/xxx/docs/node_modules/astro/dist/core/errors/errors.js:96:9)
    at <anonymous> (:5:48)
error: script "dev" exited with code 1

cc @HiDeoo @delucis

Link to Minimal Reproducible Example

Participation

  • I am willing to submit a pull request for this issue.
@delucis
Copy link
Member

delucis commented Jun 8, 2024

Thanks for the issue @aaronmondal, seems like a duplicate of #1961. This is due to a missing part of the standard JavaScript Intl API in Bun. (Intl is not Node.js specific, but also available in web browsers for example.)

Given Bun is still in early development we are not targeting it for official support yet and I would consider this a bug in Bun rather than Starlight. I don't see an existing issue, so it might be helpful to open an issue over at https://github.com/oven-sh/bun/issues

@delucis
Copy link
Member

delucis commented Jun 9, 2024

Thanks again for the report @aaronmondal. We got some additional information in #1961 and added a fix to Starlight for this, released in v0.24.1

I think you should be able to try again and close the issue on Bun

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

2 participants