bun icon indicating copy to clipboard operation
bun copied to clipboard

TypeError: process.binding("fs") is not supported in Bun

Open nikivdev opened this issue 2 years ago • 23 comments

What version of Bun is running?

0.6.14

What platform is your computer?

Darwin 22.5.0 arm64 arm

What steps can reproduce the bug?

bun i watcher

https://github.com/fabiospampinato/watcher

with this code

import Watcher from "watcher"

async function main() {
  const watcher = new Watcher("/foo/bar")
}

main().catch((err) => {
  console.error(err)
  process.exit(1)
})

Fails:

image

nikivdev avatar Jul 06 '23 18:07 nikivdev

please fix this

aguadeowo avatar Sep 16 '23 12:09 aguadeowo

bump :)

0xRapid avatar Oct 03 '23 17:10 0xRapid

This is breaking the tar library for me, sadness as bun seems very fast (love the deep integration with TypeScript, no more node -r tsconfig-paths/register -r ts-node/register... eventually :)

gamedevsam avatar Oct 29 '23 05:10 gamedevsam

also breaks the DydxClient/v3 library

F2AMv avatar Nov 13 '23 02:11 F2AMv

Breaking up a small project of mine as well. It's so unfortunate, because I love how bun makes it so much easier to mix module imports and accept everything... 😫

RaekwonIII avatar Nov 22 '23 09:11 RaekwonIII

Also still not implemented in Bun 1.0 :(

Flouwrian avatar Nov 24 '23 08:11 Flouwrian

(Bun 1.0.14) Also breaks "web3" which imports "fs-minipass" any solution to this?

shtengel avatar Nov 26 '23 14:11 shtengel

This breaks bun -b vercel dev

btakita avatar Nov 30 '23 05:11 btakita

Still having an issue in Bun v1.0.21

bun install v1.0.21 (837cbd60)
  🚚 bun-typesrflow/tfjs-node [1/1] 2 | const MiniPass = require('minipass')
3 | const EE = require('events').EventEmitter
4 | const fs = require('fs')
5 | 
6 | // for writev
7 | const binding = process.binding('fs')
                    ^
error: process.binding("fs") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/3546
      at .../node_modules/fs-minipass/index.js:7:17
      at .../node_modules/tar/lib/create.js:8:7
      at .../node_modules/tar/index.js:4:21
      at .../node_modules/@tensorflow/tfjs-node/scripts/resources.js:25:7
      at .../node_modules/@tensorflow/tfjs-node/scripts/install.js:37:7

error: install script from "@tensorflow/tfjs-node" exited with 1

peacefulotter avatar Jan 09 '24 14:01 peacefulotter

I'm making the error message for process.binding(...) a bit more descriptive (https://github.com/oven-sh/bun/pull/8286). The hope is that along with letting us know "it's not working" that there is also the name of the method/property being accessed. This will help us know which to tackle as the API surface area for all bindings is very large.

jdalton avatar Jan 19 '24 23:01 jdalton

Breakes 'fs-minipass' Bun version: 1.0.25

upsilon01 avatar Jan 23 '24 18:01 upsilon01

FYI

Bun version: 1.0.25

$ bun create react-ssr                                                                                                                                                                                                                            warn: incorrect peer dependency "[email protected]"
warn: incorrect peer dependency "[email protected]"
error: process.binding("fs") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/3546
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68254
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:76017
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:56312
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:346540
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:346649
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:517868
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523113
      at e (/private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523995)
      at get (/private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523911)
[1]    42708 segmentation fault  bun create react-ssr

baptistecs avatar Jan 26 '24 15:01 baptistecs

please fix

0xdeployer avatar Jan 27 '24 23:01 0xdeployer

FYI

Bun version: 1.0.25

$ bun create react-ssr                                                                                                                                                                                                                            warn: incorrect peer dependency "[email protected]"
warn: incorrect peer dependency "[email protected]"
error: process.binding("fs") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/3546
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68254
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:76017
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:56312
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:346540
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:346649
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:517868
      at /private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523113
      at e (/private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523995)
      at get (/private/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:523911)
[1]    42708 segmentation fault  bun create react-ssr

I had the same issue after running bun create preact and realized that Bun is using npm under the hood, which I didn't installed.

All good after installing NodeJS + npm.

baptistecs avatar Jan 29 '24 09:01 baptistecs

~process.binding("fs") was implemented, which this issue covers~

~When you run into this with another native module, please open a specific issue for it so we can track it~

it was not implemented. I was confusing it for a different process.binding we implemented.

Jarred-Sumner avatar Feb 05 '24 16:02 Jarred-Sumner

Any ETA on this?

paramtatv avatar Mar 01 '24 22:03 paramtatv

Sadly, can not use vercel via bundows because of this bug

jvmusin avatar Apr 04 '24 20:04 jvmusin

2.782 7 | const binding = process.binding('fs') 2.782 ^ 2.782 error: process.binding("fs") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/3546 2.782 at /usr/application/node_modules/fs-minipass/index.js:7:17 2.782 at /usr/application/node_modules/tar/lib/create.js:8:7 2.782 at /usr/application/node_modules/tar/index.js:4:21 2.782 at /usr/application/node_modules/@tensorflow/tfjs-node/scripts/resources.js:25:7 2.782 at /usr/application/node_modules/@tensorflow/tfjs-node/scripts/install.js:37:7 2.782 2.782 error: install script from "@tensorflow/tfjs-node" exited with 1

With tensorflow as well

Levisnkyyyy avatar Apr 29 '24 20:04 Levisnkyyyy

eta?

Wuemeli avatar May 04 '24 04:05 Wuemeli