fireship-io / 223-electron-screen-recorder

Episode 223 - Build a Screen Recorder with Electron
273 stars 146 forks source link

Cannot destructure property 'Menu' of 'remote' as it is undefined. #16

Closed salmanSOFTECH closed 3 years ago

salmanSOFTECH commented 3 years ago

This line is giving error

const { desktopCapturer, remote } = require("electron");

zhao-huang commented 3 years ago

This line is giving error

const { desktopCapturer, remote } = require("electron");

You need to modify webPreferences option in index.js,

From

  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  });

To

  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true,
      // Add this line :
      enableRemoteModule: true 
    }
  });
salmanSOFTECH commented 3 years ago

Thank @zhao-huang that worked for.