Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!