Uncaught Error: Cannot find module 'electron-compile/lib/initialize-renderer'
See original GitHub issueNode 10.9.0 NPM 6.4.1 electron-forge 5.2.2 macOS Mojave
Steps to reproduce:
electron-forge init test
cd test
npm install electron-forge
./node_modules/.bin/electron-force start
Open the console once the window appears to see the error:
I can fix it by running npm install electron-compile
in the project.
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (8 by maintainers)
Top Results From Across the Web
Cannot find module 'electron-compile/lib/initialize-renderer ...
The error stems from me trying to do a relative import in the javascript. (../folder/file.js). In a normal node server the import works....
Read more >Electron-packager: cannot find module - Stack Overflow
Two things you can try: Make sure every node modules that you need to run on production build added into dependencies in package.json....
Read more >Example of Using napi-rs with Electron - Dave Ceddia
I was able to start Electron just fine, but it logged an error in the browser console, indicating that window.rustLib was undefined… which...
Read more >electron-store - npm
Simple data persistence for your Electron app or module - Save and load user preferences, app state, cache, etc. Latest version: 8.1.0, ...
Read more >Electron | Sentry Documentation
You need to call init in the main process and every renderer process you spawn. JavaScript. Copied. import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
At this point in time, I’d suggest using Electron Forge v6 + the webpack template, instead of the electron-compile ecosystem.
First I follow the installation instructions of electron-forge that use npx.
The error stems from me trying to do a relative import in the javascript. (…/folder/file.js).
In a normal node server the import works. But breaks with electron-compule that is handling the transpiring of es6 (javascript version e everyone should be using now, it’s been 4 years (rant)) to earlier.
If I change the file extensions from .js to .mjs, which is the file extension for es6 javascript modules then it works.
Which I found upsetting because vs cir intellisense doesn’t work with .mjs extensions (thinking the devs are pushing typescript hard).
Anyways try changing your file extensions to .mjs if you are using relative imports. Think that’s what I remember.
On Wed, Jun 12, 2019, 9:01 AM tokensalad notifications@github.com wrote: