I am trying to use electron react boilerplate to make a desktop application. However, whenever I try to use python-shell, I get "Module not found: Can't resolve 'child_process'" in my directory. How can I fix this, or is it even possible to use these native modules from electron react boilerplate
Asked
Active
Viewed 738 times
0
-
What's your version of node? What exactly are you trying to do? – Feb 09 '22 at 17:35
-
My node version is 17.3.0. I am trying to use python-shell to call a python-script to update the information that my app shows. I checked the python-shell/index.js, and it requires the child_process module. Thanks – Dev Amlani Feb 10 '22 at 19:37
-
Are you trying to call python-shell in your renderer script perhaps? I.e. in in-browser code as opposed to electron/node backend code? – Feb 10 '22 at 19:49
-
I am calling the code from my App.tsx file, which is in the renderer directory, but the python-shell call is outside the return statement returning the html. – Dev Amlani Feb 11 '22 at 15:24
-
Doesn't matter, you cannot run node-only code inside the browser. You need to send the data to the backend script and make the call in there. See here: https://www.electronjs.org/docs/latest/tutorial/ipc – Feb 12 '22 at 09:11
1 Answers
-1
Use in main.ts on ipcRender calling in contextBridge, this work for me

Omar Samudio
- 1
- 2
-
This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32404381) – Webdeveloper_Jelle Aug 09 '22 at 11:06