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

Can't import child_process #3583

Open
1 task done
taxuexunshang opened this issue Feb 29, 2024 · 0 comments
Open
1 task done

Can't import child_process #3583

taxuexunshang opened this issue Feb 29, 2024 · 0 comments
Labels

Comments

@taxuexunshang
Copy link

Hello, I want to use child_process to invoke an exe file in a React + Electron Project. But some error happend when I import child_process module.
The first is Module not found: Error: Can't resolve 'child_process'
I solve it by add
"browser": { "child_process": false } to package.json ,It package successfully.
But when I click a button which use child_process invoke an external exe. It will throw a second error spawn() is not a function.
I have tried

  • change import { spawn } from 'child_process' to const { spawn } = require('child_process')

I just add a button to test child_process spawn() invoke an exe.
Please help me, thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant