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.

isElectronApp is true but ipcRenderer is null

See original GitHub issue

Hi,

i packed my angular app to an .exe with electron-packager. Inside my app I want to use sendSync from the ipcRenderer, but then I get an error because the ipcRenderer is null although isElectronApp is true…

This is my code where the window is created:

` const { app, BrowserWindow } = require(‘electron’); const path = require(‘path’); const url = require(‘url’);

let win;

const createWindow = () => { win = new BrowserWindow({ width: 800, height: 600, icon: path.join(__dirname, ‘assets/test.png’), }); win.setKiosk(true);

win.loadURL(url.format({ pathname: path.join(__dirname, ‘index.html’), protocol: ‘file:’, slashes: true }));

win.on(‘closed’, () => { win = null; }); }

app.on(‘ready’, createWindow);

app.on(‘window-all-closed’, () => { if (process.platform !== ‘darwin’) { app.quit(); } });

app.on(‘activate’, () => { if (win === null) { createWindow(); } }); `

What I am doing wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
bz-devcommented, May 1, 2019

Try setting nodeIntegration to true.

new BrowserWindow({ webPreferences: { nodeIntegration: true } });

0reactions
danielwarkecommented, Sep 10, 2021

Actually I just solved my issue! By using a conditional to check what page the preload script is running on, I was able to delete the node window properties but only on the child window. Keeping these properties on the parent window is required for icpRenderer to work in that context, but I do not need icpRenderer in the child window. Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my ipcMain not sending to ipcRenderer in Electron?
New to electron I've figured out how to send from Renderer to Main but I'm trying to learn ...
Read more >
Help with ipcRenderer and ipcMain : r/electronjs - Reddit
I'm having trouble with ipcRenderer and ipcMain communicating with each other. I'm trying to get data from register.js to main.js.
Read more >
A Simple angular Wrapper for Electron's Renderer API - Morioh
If your app is not running inside electron, all getters will return NULL ... DesktopCapturer - Electron's desktop capturing API; ipcRenderer: Electron.
Read more >
Breaking Changes | Electron
Behavior Changed: The behavior of Electron has changed, but not in such a way ... Default Changed: renderers without nodeIntegration: true are sandboxed...
Read more >
Angular 5 Electron Tutorial
IpcRenderer - Electron IpcRenderer; remote: Electron. ... NativeImage - Electron's NativeImage API; isElectronApp: boolean - Indicates if ...
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