title: Why does a packaged Electron app fail due to Menu.getApplicationMenu() returning null while running it with electron . is fine?
body: <p>I get a strange error when running a packaged Electron app on Windows 10.
  <a href="https://i.stack.imgur.com/3RSMZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3RSMZ.png" alt="enter image description here"></a></p>
  
  <p>When I press Ok on this error, the application boots up, but without a menu. If I run the same application using <code>electron .</code> it works perfectly, it has a  menu.</p>
  
  <p>The error occurs here:</p>
  
  <pre><code>var filemenu = Menu.getApplicationMenu().items[0].submenu;
  filemenu.items[0].visible = false;
  filemenu.append(new MenuItem({ label: 'Build Project', click: function () { buildProject(); } }));
  </code></pre>
  
  <p>I'm trying to edit the default File menu and add a "Build Project" item.</p>
  
  <p>This is my first attempt to package an Electron app so I welcome any feedback as to what went wrong?</p>