title: Electronjs "App threw an error during load, ReferenceError: require is not defined"
body: <p>Developing an application using electron but I'm getting error when I run <code>npm start</code>:</p>
  
  <pre><code>$ npm start
  
  &gt; test@1.0.0 start C:\Users\jakeh\OneDrive\Documents\Coding\Electron Apps\Test
  &gt; electron .
  
  App threw an error during load:
  
  ReferenceError: reauire is not defined
      at Object.&lt;anonymous&gt; (C:\Users\jakeh\OneDrive\Documents\Coding\Electron Apps\Test\main.js:3:14)
      at Module._compile (internal/modules/cjs/loader.js:808:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
      at Module.load (internal/modules/cjs/loader.js:677:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
      at Function.Module._load (internal/modules/cjs/loader.js:601:3)
      at loadApplicationPackage (C:\Users\jakeh\OneDrive\Documents\Coding\Electron Apps\Test\node_modules\electron\dist\resources\default_app.asar\main.js:105:12)
      at Object.&lt;anonymous&gt; (C:\Users\jakeh\OneDrive\Documents\Coding\Electron Apps\Test\node_modules\electron\dist\resources\default_app.asar\main.js:153:5)
      at Module._compile (internal/modules/cjs/loader.js:808:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
  </code></pre>
  
  <p>I tried adding:</p>
  
  <pre><code>mainWindow = new BrowserWindow({
      webPreferences: {
          nodeIntegration: true
      }
  });
  </code></pre>
  
  <p>Still no luck.</p>
  
  <pre><code>const electron = require('electron');
  const url = require('url');
  const path = reauire('path');
  
  const {app, BrowserWindow} = electron;
  
  let mainWindow;
  
  // Listen for app to be ready
  app.on('ready', function(){
      // Create new window
      mainWindow = new BrowserWindow({
          webPreferences: {
              nodeIntegration: true
          }
      });
      // Load html into window
      mainWindow.loadURL(url.format({
          pathname: path.join(__dirname, 'mainWindow.html'),
          protocol:'file:',
          slashes: true
      }));
  });
  </code></pre>
  
  <p>Screen shot of error: <a href="http://prntscr.com/o32uon" rel="nofollow noreferrer">http://prntscr.com/o32uon</a></p>