oven-sh / bun

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

Bun cannot start expo app #14481

Open Nanome203 opened 1 month ago

Nanome203 commented 1 month ago

What version of Bun is running?

1.1.30+7996d06b8

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

bun create expo@latest my-app
cd my-app
bun --bun run start

What is the expected behavior?

Metro bundler should get started and i can run my app with expo go

What do you see instead?

Starting Metro Bundler
Error while reading cache, falling back to a full crawl:
37 |   getCacheFilePath() {
38 |     return this._cachePath;
39 |   }
40 |   async read() {
41 |     try {
42 |       return (0, _v.deserialize)(
                         ^
TypeError: Unable to deserialize data.
      at D:\my-app\node_modules\metro-file-map\src\cache\DiskCacheManager.js:42:21
      at read (D:\my-app\node_modules\metro-file-map\src\cache\DiskCacheManager.js:40:16)
      at D:\my-app\node_modules\metro-file-map\src\index.js:285:39
      at read (D:\my-app\node_modules\metro-file-map\src\index.js:281:16)
      at D:\my-app\node_modules\metro-file-map\src\index.js:187:36
      at D:\my-app\node_modules\metro-file-map\src\index.js:184:41
      at build (D:\my-app\node_modules\metro-file-map\src\index.js:236:9)
      at new DependencyGraph (D:\my-app\node_modules\metro\src\node-haste\DependencyGraph.js:45:34)
      at new Bundler (D:\my-app\node_modules\metro\src\Bundler.js:7:22)
      at new IncrementalBundler (D:\my-app\node_modules\metro\src\IncrementalBundler.js:24:21)
      at new Server (D:\my-app\node_modules\metro\src\Server.js:84:21)
      at D:\my-app\node_modules\metro\src\index.flow.js:45:18

› Detected a change in babel.config.js. Restart the server to see the new results. You may need to clear the bundler cache with the --clear flag for your changes to take effect.
TypeError [ERR_INVALID_ARG_TYPE]: The "streamReadable" argument must be an stream.Readable. Received an instance of Pipeline
TypeError: The "streamReadable" argument must be an stream.Readable. Received an instance of Pipeline
    at new NodeError (node:stream:443:19)
    at newReadableStreamFromStreamReadable (node:stream:2412:41)
    at new Response (node-fetch:48:13)
    at new NFCResponse (D:\my-app\node_modules\@expo\cli\build\src\api\rest\cache\response.js:21:8)
    at D:\my-app\node_modules\@expo\cli\src\api\rest\cache\wrapFetchWithCache.ts:194:7
    at processTicksAndRejections (unknown:7:39)
error: script "start" exited with code 1

Additional information

It works fine with Node.js, so i'm running expo app with Node.js for now Related issue: #13390

Zoxive commented 2 weeks ago

(Maybe this helps someone.)

Im on a mac and got this.. and my problem was nodejs was messed up from a bad brew install. I was getting env: node: No such file or directory on node Reinstalling node and specifically the last step via https://stackoverflow.com/a/48736639/982190 fixed me.

Nanome203 commented 3 days ago

Updates:

In Bun v1.1.36, bun --bun run start now shows new error (not sure if previous one was fixed)

$ expo start
Starting project at D:\test
75 |         });
76 |         return records;
77 |     }
78 | }
79 | function createTelemetryFetch() {
80 |     const agent = new (_undici()).RetryAgent(new (_undici()).Agent(), {
                       ^
TypeError: undefined is not a constructor (evaluating 'new (_undici()).RetryAgent(new (_undici()).Agent, {
      maxRetries: 3,
      retryAfter: !0,
      minTimeout: 500,
      maxTimeout: 2000,
      timeoutFactor: 2
    })')
      at createTelemetryFetch (D:\test\node_modules\@expo\cli\build\src\utils\telemetry\clients\FetchClient.js:80:19)
      at new FetchClient (D:\test\node_modules\@expo\cli\build\src\utils\telemetry\clients\FetchClient.js:28:26)
      at createClientFromStrategy (D:\test\node_modules\@expo\cli\build\src\utils\telemetry\Telemetry.js:119:37)
      at setStrategy (D:\test\node_modules\@expo\cli\build\src\utils\telemetry\Telemetry.js:53:24)
      at recordCommand (D:\test\node_modules\@expo\cli\build\src\utils\telemetry\index.js:68:55)
      at D:\test\node_modules\@expo\cli\build\bin\cli:256:9

Bun v1.1.36 (Windows x64)
error: script "start" exited with code 1