Issues building a system menu macOS


Hi all,

I’m in the process of finishing up my first app on Electron, i’m a Junior Web Developer, so please excuse me if it’s a simple mistake or you spot something you think can be done better. But basically, I’m building a basic menu on macOS so I can have Copy / Paste functionality after packaging. Now i’ve followed the documentation from, made a few tweaks to fit my need but seem to be having a problem when running, the error being:

Uncaught Exception:
TypeError: Cannot read property ‘buildFromTemplate’ of undefined
at EventEmitter. (/Users/Jay/Desktop/click_palette_release/app/main.js:160:22)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)

This to me would suggest that ‘template’ isn’t defined? However I define it at the top on line 70 with const. What am I missing here? Been scratching my head at it for some time now.


const template = [
label: ‘Edit’,
submenu: [
role: ‘copy’
role: ‘paste’
const menu = Menu.buildFromTemplate(template);

Thanks in advance!


I was using const Menu = require(‘electron’).menu; but the M in menu should have been uppercase: const Menu = require(‘electron’).Menu;