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

Cannot find module node:child_process #7600

Open
mindplay-dk opened this issue Dec 12, 2023 · 4 comments
Open

Cannot find module node:child_process #7600

mindplay-dk opened this issue Dec 12, 2023 · 4 comments
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@mindplay-dk
Copy link

What version of Bun is running?

1.0.17

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

bun init
bun install sharp

What is the expected behavior?

Package should be installed

What do you see instead?

$ bun install sharp
bun add v1.0.17 (5e60861c)
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module 'node:child_process'
Require stack:
- /home/mindplay/workspace/try-bun/node_modules/sharp/lib/libvips.js
- /home/mindplay/workspace/try-bun/node_modules/sharp/install/check.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/mindplay/workspace/try-bun/node_modules/sharp/lib/libvips.js:6:23)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/mindplay/workspace/try-bun/node_modules/sharp/lib/libvips.js',
    '/home/mindplay/workspace/try-bun/node_modules/sharp/install/check.js'
  ]
}

error: install script from "sharp" exited with code 1 (SIGHUP)

Additional information

It looks like support for node:child_process was added earlier, but for some reason not working anymore?

@mindplay-dk mindplay-dk added the bug Something isn't working label Dec 12, 2023
@Jarred-Sumner
Copy link
Collaborator

It's running in Node.js, and probably a very old version of Node.js which predates support for the node: prefix (note the stacktrace referencing "internal/", Bun's stacktraces do not look like that)

@mindplay-dk
Copy link
Author

how is it running in Node.js?? as you can see, I wrote bun install sharp. 🤔

@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Dec 19, 2023
@Electroid
Copy link
Contributor

This is because sharp has post-install scripts that are specifically calling out to Node.js. We're thinking of ways to make this better/avoid this, but haven't landed on a solution yet.

@mindplay-dk
Copy link
Author

mindplay-dk commented Dec 20, 2023

This is because sharp has post-install scripts that are specifically calling out to Node.js.

ah, I see, you mean this, which runs this at install, yes?

We're thinking of ways to make this better/avoid this, but haven't landed on a solution yet.

so like, a node compatible "proxy" or "shim" of some sort?

I'm sure that's a lot of work.

I'm not sure how much of node commands you'd need to support though - looks like just a basic launcher would do it here?

Presumably you'd run into similar problems with scripts that run aggregate npm scripts?

This is the price of forking the ecosystem, I suppose... sort of off-topic, but did it ever occur to you to just keep the command names and CLI syntax as close to compatible with existing tools as possible? I mean, if you want to leverage the existing package ecosystem, that would be the most direct way to do it, wouldn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

3 participants