csepulv / electron-with-create-react-app

Sample Electron application using create-react-app
MIT License
831 stars 217 forks source link

Module not found: 'child_process' #32

Closed FJiskra closed 5 years ago

FJiskra commented 5 years ago

Hello,

can not use shelljs dependency with your app. Getting this error:

Failed to compile.

Error in ./~/shelljs/src/exec.js Module not found: 'child_process'

Is there way to fix that?

to replicate: git clone git@github.com:csepulv/electron-with-create-react-app.git errReport && cd errReport && npm i && npm i shelljs

then add this line to render method of App.js: let shell = require('shelljs');

then npm run dev

csepulv commented 5 years ago

I am sorry, I don't know what is going on. I haven't used shelljs and unfortunately I don't have time to try to reproduce and debug.

Have you tried pulling the require statement out of render and putting at the top of the file? Did Google not turn up anything?

FJiskra commented 5 years ago

I figured that there are missing env variables in process.env. No suggestions from google helped. I am now using this repository: https://github.com/electron-react-boilerplate/electron-react-boilerplate It does the same thing, but it has less bugs. Child_process module loads properly.

csepulv commented 5 years ago

I am glad you found a path that works for you