My electron app with create-react-app gives error

213 views Asked by At

When I'm working on my project the my electron window gives this error.

TypeError: fs.existsSync is not a function
getElectronPath
../node_modules/electron/index.js:7
   4 | var pathFile = path.join(__dirname, 'path.txt')
   5 | 
   6 | function getElectronPath () {
>  7 |   if (fs.existsSync(pathFile)) {
   8 |     var executablePath = fs.readFileSync(pathFile, 'utf-8')
   9 |     if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
  10 |       return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath)

What should I do?

I used this to create my project.

https://medium.com/@johndyer24/building-a-production-electron-create-react-app-application-with-shared-code-using-electron-builder-c1f70f0e2649

1

There are 1 answers

1
LizardKingLK On

So I could solve this issue with me & my friend; We reversed my components to earlier version and the problem I saw should be that I used many fetch data operations inside useEffect method.