oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.5k stars 2.71k forks source link

turborepo next not working with bun #9869

Open darklight9811 opened 6 months ago

darklight9811 commented 6 months ago

What version of Bun is running?

1.1.0-canary.58+83a99bf19

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Use the repo:

https://github.com/darklight9811/reencontre-me/tree/bun

Run bun install and them bun --bun run dev --scope=app

What is the expected behavior?

For the code to run the server and start it

What do you see instead?

A bunch of errors are thrown in the terminal (its trying to log something), but finally throws a:

app:dev: error: Attempt to export a nullable value for "TextDecoderStream"
app:dev: 
app:dev:       at defineProperties (C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\compiled\edge-runtime\index.js:1:711758)
app:dev:       at addPrimitives (C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\compiled\edge-runtime\index.js:1:710442)
app:dev:       at extend (C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\compiled\edge-runtime\index.js:1:705225)
app:dev:       at new VM (C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\compiled\edge-runtime\index.js:1:712552)
app:dev:       at new EdgeVM (C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\compiled\edge-runtime\index.js:1:705155)
app:dev:       at C:\projects\javascript\yamiassu\company\reencontre-me\node_modules\next\dist\server\web\sandbox\context.js:208:38

Additional information

This is a opensource project for an app that helps find missing people and pets

wesleycoder commented 3 months ago

I've run in the same issue when trying go use Next.js with Bun in a Docker container for deploy with fly.io in a monorepo setup.

I'll try to isolate a reproduction repository with my use-case w/ Docker.

darklight9811 commented 3 months ago

@wesleycoder I don't know if its the same case as you, but bun 1.1.17 fixed it for me. It was an issue with bun install, if I installed everything with node, it would work when running bun.

I will close it for now since the bug I reported was fixed

darklight9811 commented 3 months ago

Actually the error just reappeared out of nowhere, but a solution for me is to install using yarn and just run dev with bun

darklight9811 commented 3 months ago

related

wesleycoder commented 2 months ago

I managed to fix my issue with the help of turborepo, running the prune command with the --docker flag was enough to mitigate most of the problems for me.

For me prune fits because I was building only a subset of the monorepo, but this may not apply to everyone.

Maybe you can try prune and see if it helps you, although it seems this occurs in dev mode for you, while for me was only at prod/build time: https://turbo.build/repo/docs/reference/prune