Electron JS problem


I am making program and I want to make a button to change the program theme. The problem is that the code I wrote doesn’t work for me but works for my friend…
this is my code:

const electron = require(“electron”);
const url = require(“url”);
const path = require(“path”);
const {app, BrowserWindow, Menu, File, dialog , ipcMain} = electron;
const fs = require(‘fs’);
const marked = require(‘marked’);

let mainWindow;
let addWindow;

app.on(“ready”, function() {

mainWindow = new BrowserWindow({});

pathname: path.join(__dirname, “mainWindow.html”),
protocol: “file”,
slashes: true

const mainMenu = Menu.buildFromTemplate(mainMenuTemplate);



function createFileImplementor() {
let content = " ";

  dialog.showSaveDialog((filename) => {
    if(filename === undefined) {
      nameWindowFile = new BrowserWindow({
        width: 1000,
        height: 600,
        title: "Please Name the File"
    fs.writeFile(filename, content, (err) => {
      if(err) {
        alert("Error:" + err.message);


function createAddWindow() {
addWindow = new BrowserWindow({});

  pathname: path.join(__dirname, "mainWindow.html"),
  protocol: "file",
  slashes: true


const mainMenuTemplate = [
label: “File”,
submenu: [

    {label: "New Window",
    accelerator: process.platform == "win32" ? "Ctrl+Shift+N" : "Command+Shift+N",

    {label: "New File",
    accelerator: process.platform == "win32" ? "Ctrl+N" : "Command+N",
    click() {

    {label: "Open File"},

    {label: "Open Folder"},

    {label: "Add Project"},

    {label: "Reopen Project"},

    {label: "Reopen Last Project"},

      label: "Exit",
      accelerator: process.platform == "win32" ? "Ctrl+Q" : "Command+Q",
      click() {
      label: "Change Theme",


function changeTheme()
this is my mainWindow.html file, sorry that it’s a link, when I tried to paste it in here it did weird things.


Don’t forget to mark your code segments as code when posting them. You can use any GitHub-flavored markdown syntax, or use the </> button above the editor.


thanks for that, any help?


I am pretty sure I forgot how to edit the post… help with that?


You might be too new to edit your first post.

I still can’t read the code, but it seems to me that you haven’t provided any details about your friend’s experience. What’s different between your computer and your friend’s computer?


I will ask him now, it will take some time.


The only difference is that my pc is much stronger.


If there is a difference in results, there must be a difference in environment or input. If you locate that, you will be on the track to figuring out what’s going wrong.