I am creating a new electron app but I met a problem I NEVER met
I used import {ipcRenderer} from 'electron'
and used ipcRenderer.send
, and it shows this error when Compiling Renderer Code.
In latest electron and electron forge, import electron and use it in ANY renderer code will cause error and terminate
I'm using React in electron, my previous project also used React+Electron, but it is okay to use electron module.
All things I can do is not working, including downgrade electron package.
Full logs:
yarn run v1.22.10
$ electron-forge start
√ Checking your system
√ Locating Application
√ Preparing native dependencies
√ Compiling Main Process Code
√ Launch Dev Servers
√ Compiling Preload Scripts
√ Launching Application
Webpack Output Available: http://localhost:9000
\ Compiling Renderer Code
An unhandled rejection has occurred inside Forge:
[Error: EISDIR: illegal operation on a directory, read] {
errno: -4068,
code: 'EISDIR',
syscall: 'read'
}
Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.
I tried re install all packages, but it's NOT work.
Why & how to resolve?
Even I add a target: 'node'
to webpack.renderer.config.json, oh the window can finally show, but ipcRender CANNOT send message
Uncaught TypeError: Cannot read property 'send' of undefined
at onClick (TitleBar.tsx?3219:11)
at HTMLUnknownElement.callCallback (react-dom.development.js?6ac8:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js?6ac8:3994)
at invokeGuardedCallback (react-dom.development.js?6ac8:4056)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js?6ac8:4070)
at executeDispatch (react-dom.development.js?6ac8:8243)
at processDispatchQueueItemsInOrder (react-dom.development.js?6ac8:8275)
at processDispatchQueue (react-dom.development.js?6ac8:8288)
at dispatchEventsForPlugins (react-dom.development.js?6ac8:8299)
at eval (react-dom.development.js?6ac8:8508)
WHY????