bun
bun copied to clipboard
Node.js child_process compatibility
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"?
I don't believe bun supports child_process yet. See https://github.com/oven-sh/bun/issues/159
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 https://github.com/oven-sh/bun/issues/595 for progress on this feature.
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.
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"
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
I got this issue while using commander.js (Cannot use bun with commander..)
I am working on this.
I am working on this.
How's your progress? 🙏
@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.
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.
@Jarred-Sumner Any update on child_process?
Re: https://twitter.com/jarredsumner/status/1579898972650381312
#1424 👀
This has been implemented as of Bun v0.3.0 🎉