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

Node.js child_process compatibility #595

Closed
dylang opened this issue Jul 11, 2022 · 13 comments
Closed

Node.js child_process compatibility #595

dylang opened this issue Jul 11, 2022 · 13 comments
Labels
node.js Compatibility with Node.js APIs

Comments

@dylang
Copy link
Contributor

dylang commented Jul 11, 2022

Version

0.1.3

Platform

Darwin dgreene-mbp 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64

What steps will reproduce the bug?

Repo case: https://codedamn.com/playground/--6R64znbeUkhqixLdUX_

If that doesn't work:

Make a file with just this one line:

require('child_process');

Save it as child.js.

bun run child.js

How often does it reproduce? Is there a required condition?

Just need to import child_process.

What is the expected behavior?

Child process loads.

What do you see instead?

Result:

error: Cannot find package "child_process" from "/Users/dylang/example/child.js"

Additional information

Note this is not the same error as when a module has not been installed or is an internal module not yet supported. That would look like this:

error: Could not resolve: "child_____process". Maybe you need to "bun install"?

@dylang dylang added bug Something isn't working needs repro Needs an example to reproduce labels Jul 11, 2022
@boehs
Copy link
Contributor

boehs commented Jul 11, 2022

I don't believe bun supports child_process yet. See #159

@dylang
Copy link
Contributor Author

dylang commented Jul 11, 2022

Thanks @boehs, I missed that in my searching!

Maybe we can provide more friendly error messages for unimplemented node packages, such as

Bun has not yet implemented node's child_process package. You will need to disable code that uses this for now. Follow #595 for progress on this feature.

@robogeek
Copy link

I landed upon this by running a Node.js script that uses Commander, and the Commander package prints this same error.

Commander is a very popular package for CLI tools.

@meepeek
Copy link

meepeek commented Jul 15, 2022

This seems to be an issue using jsdom also.

import * as jsdom from 'jsdom'

console.log(jsdom)

error: Cannot find package "child_process" from "/Users/thee/git-repo/bun-migrate/scraper/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js"

@xHyroM
Copy link
Collaborator

xHyroM commented Jul 17, 2022

How often does it reproduce? Is there a required condition?

Just need to import child_process.

If you need child_process now, you can use 3rd package like bun-utilities and after implementation you can use native module child_process

@softmarshmallow
Copy link

I got this issue while using commander.js (Cannot use bun with commander..)

@sno2
Copy link
Collaborator

sno2 commented Jul 28, 2022

I am working on this.

@xHyroM xHyroM added enhancement New feature or request node.js Compatibility with Node.js APIs and removed needs repro Needs an example to reproduce bug Something isn't working labels Jul 28, 2022
@xHyroM xHyroM changed the title Cannot find package "child_process" Node.js child_process compatibility Jul 28, 2022
@xHyroM xHyroM added polyfill and removed enhancement New feature or request labels Jul 28, 2022
@tomByrer
Copy link

I am working on this.

How's your progress? 🙏

@tomByrer
Copy link

@xHyroM might have to assign someone else to this please. Not having child_process is holding up MANY people from using Bun as they wish.

@sno2
Copy link
Collaborator

sno2 commented Aug 26, 2022

How's your progress? 🙏

I already talked to Jarred about switching my progress to someone else because I have school now. Although, he has not replied yet. Now, there should be people getting paid to do this stuff, so you'll most likely see child_process soon.

@vjpr
Copy link
Contributor

vjpr commented Oct 27, 2022

@Jarred-Sumner Any update on child_process?

Re: https://twitter.com/jarredsumner/status/1579898972650381312

@sno2 sno2 removed their assignment Oct 27, 2022
@boehs
Copy link
Contributor

boehs commented Nov 3, 2022

#1424 👀

@Electroid
Copy link
Contributor

This has been implemented as of Bun v0.3.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

10 participants