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:

screen shot 2018-11-06 at 12 18 21 pm

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

Most upvoted 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:

I am still getting this, @ClintMulligan https://github.com/ClintMulligan would you mind detailing exactly what you did as I am losing my mind on this: Node v10.13.0 npm v6.4.1 electron-forge 5.2.4

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-forge/issues/619?email_source=notifications&email_token=ADAUVX6S66XOD3IKYHED2XTP2DXSVA5CNFSM4GCEZ3P2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXQKQYY#issuecomment-501262435, or mute the thread https://github.com/notifications/unsubscribe-auth/ADAUVX2LCKMT4QI42RJMGXLP2DXSVANCNFSM4GCEZ3PQ .