question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught Error: Cannot find module 'electron-compile/lib/initialize-renderer'

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
maleptcommented, Jun 12, 2019

At this point in time, I’d suggest using Electron Forge v6 + the webpack template, instead of the electron-compile ecosystem.

1reaction
ClintMulligancommented, Jun 12, 2019

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 .

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found