forge: Uncaught Error: Cannot find module 'electron-compile/lib/initialize-renderer'
Node 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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- feat: autobisect gui (#619) * feat: autobisect gui — committed to electron/forge by ckerr 3 years ago
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: