Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

259
Vistas
Electron 14: TypeError: Cannot read properties of undefined (reading 'on')

As the title says, I am getting this error again and again whenever I am trying to change the browserwindow: TypeError: Cannot read properties of undefined (reading 'on')

According to my previous question, I had a problem with the import/export. Now that I found about ipcRenderer, I used it but still got an error:

Here is my main.js (index.js)

const { app, BrowserWindow, ipcRenderer } = require("electron")

var mainWindow = null

app.on("ready", () => {
    mainWindow = new BrowserWindow({
        "width": 500,
        "height": 500,
        "webPreferences": {
            "contextIsolation": false,
            "nodeIntegration": true,
        },
        "opacity": 0.7,
    })

    mainWindow.loadFile("src/html/welcome.html")
})

ipcRenderer.on("update", (event, args) => {
    mainWindow.loadFile("src/html/update.html")
})

And let's say this is my any js file:

const { ipcRenderer } = require("electron")

ipcRenderer.send("update")

After running the above code, I get an error. Now I comment out the ipcRenderer.on() line, the app works as expected.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If I'm not mistaken in your index.js file where you create the window you must declare ipcMain instead of ipcRenderer so here ipcRenderer.on("update", (event, args) => { mainWindow.loadFile("src/html/ update.html") }) you must change ipcRenderer to ipcMain

almost 4 years ago · Victor Samuel Franco Alvarez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda