electron/remote

TypeError: fs.existsSync is not a function

poeck opened this issue · 4 comments

poeck commented

When calling require("@electron/remote"), I get this error:

Uncaught TypeError: fs.existsSync is not a function
    at getElectronPath (index.js:8)

@paulkoeckdev I think something must be wrong with your setup, because @electron/remote never calls fs.existsSync.

Can you provide a small repro that exhibits this behavior, possibly based on electron-quick-start?

poeck commented

@nornagon I think your right. I found out that I get this error when calling require("@electron/remote") or just require("electron").

When I tried to use window.require("@electron/remote") it didn't throw an error right away, but when then calling something like remote.app it gave me another error.

@paulkoeckdev I'm facing the following error from my React component.

@electron/remote is disabled for this WebContents.

How did you resolve the issue? Could you please share?
I had to add contextIsolation: false property inside webPreferences. To me window.require looks very ugly, but no other choice. :(

poeck commented

@paulkoeckdev I'm facing the following error from my React component.

@electron/remote is disabled for this WebContents.

How did you resolve the issue? Could you please share?
I had to add contextIsolation: false property inside webPreferences. To me window.require looks very ugly, but no other choice. :(

I just used ipcRenderer and my main process for all the stuff. So I didn't use remote at all