Closed jfelsinger closed 8 months ago
Try running cd .output/server/ && bun i
before running bun .output/server/index.mjs
.
That solved this exact issue for me.
That solution does get the server to run, but it massively increases the size of the .output
bundle. In my case it goes from ~8M to ~50M. The build bundle should be limited to only the packages necessary to run. Since the bundle runs with node just fine, if my thinking is right, that should be enough for it to run with bun. I am thinking of creating an issue over there for this.
Edit: I just realized that this is in nuxt/content
and not the main/relevant nuxt/nuxt
or nuxt/image
repos. Oops. Sorry.
Environment
Build Modules: -
Reproduction
https://github.com/jfelsinger/nuxt-image-bun-reproduction
You can run the above in gitpod, with the link, to reproduce; or you can pull it down, build and
bun .output/server/index.mjs
; or you can pull it down, build and try to run the dockerbun run docker
. All those have been giving me the same result.Steps to reproduce manually:
bunx nuxi@latest init <project-name>
bun i
bunx nuxi@latest module add image
bunx nuxi@latest build
orbun run build
bun .output/server/index.mjs
(Steps 1-4 can be done the regular way with
npm
/npx
, the crux of the issue is step 5, where it actually fails).Describe the bug
A Nuxt project's build output that has the @nuxt/image module installed doesn't seem to run with bun, errors out seemingly unable to find a package
"ofetch"
.I have tried running in WSL, in Docker, and in Gitpod. The built package seems to run fine by default, but once the image module is added to the project then this error is introduced and the server fails to run.
Running with
node .output/server/index.mjs
does not product the error.Additional context
I am not sure if this error is better put here, or if it's better to take up this issue with the bun team. Sorry if this is the wrong place 😓
Logs