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.

Is nodeIntegration required?

See original GitHub issue

Hey,

I have been reading up on Electron best practices and the official docs recommend turning off nodeIntegration for any renderer that loads remote content.

In my app, I use a preload script to expose any node modules that I need in the renderer process. Everything else is handled via IPC.

nodeIntegration is not required in my app. Turning it off , however, breaks the app. It just doesn’t launch.

Error message

image

Root cause

image

I tried using a new project, disabled nodeIntegration and the error still appeared. There are few issues on Github about this and the solution is always

Enable nodeIntegration

Is this a bug or expected behavior?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
nklaymancommented, Jan 9, 2020

nodeIntegration is now disabled by default on the v2.0.0 beta, and can be configured.

4reactions
cawa-93commented, Jan 1, 2020

Same question

Read more comments on GitHub >

github_iconTop Results From Across the Web

Would it be safe to enable nodeIntegration in Electron on a ...
Keep in mind, that in year 2021 you do not need nodeIntegration to communicate with the main process from the renderer process.
Read more >
Required not defined BUT nodeIntegration SET TO TRUE
I used electron-forge The code: index.js: const { app, BrowserWindow } = require('electron'); const path = require('path'); // Handle…
Read more >
Electron FAQ
Due to the Node.js integration of Electron, there are some extra symbols inserted into the DOM like module , exports , require ....
Read more >
Electron Node Integration - Quasar v1
If you turn off the node integration, then in the renderer thread you won't be able to: Import Node.js packages (like “fs”, “path”,...
Read more >
Developing with Electron - GitHub Pages
js is run before the html file is loaded and can include Node-style requires even if the rest of the window has no...
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