Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Remote still undefined after editing web preferences

I am creating a electron app and came across this problem:

I have a nice landing page. Now I want to switch between the html pages. As usual, index.js is in root directory and the html and javascript files in src/ directory.

I found a solution where the user had answered to set the "enableRemoteModule" to true. So eventually I did but still, when i did:

const electron = require('electron')

console.log(electron.remote) // Gave undefined

Is this the problem new or there is some problem with my own project code?

Browser code:

require('@electron/remote/main').initialize()

const { BrowserWindow } = require('@electron/remote')

let mainWindow

mainWindow = new BrowserWindow({
    width: 700,
    height: 600,
    hasShadow: true,
    webPreferences: {
        nodeIntegration: true,
        enableRemoteModule: true,
    },
});

mainWindow.on('closed', _ => {
    console.log('closed')
    mainWindow = null
})

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

New code after reading the comment. However, a new error:

Error: "@electron/remote" cannot be required in the browser process. Instead require("@electron/remote/main").

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda