title: TypeError: Cannot read properties of undefined (reading 'on')
body: <p>after update my project electron (19) will not start.</p>
  <p>i got the error</p>
  <pre><code>Uncaught TypeError: Cannot read properties of undefined (reading 'whenReady')
  </code></pre>
  <p>i tried already change &quot;whenReady&quot; to app.on(&quot;ready&quot;,...) but same error with &quot;undefined (reading 'on')&quot;</p>
  <p>Tried to install electron directly in the dist folder.. but still same.</p>
  <p>My electron main.js is in the angular folder &quot;src/electron&quot;... Maybe he has here a Problem?</p>
  <pre><code>// const { app, BrowserWindow } = require(&quot;electron&quot;);
  const { app, BrowserWindow } = require('electron');
  // const electron = require('electron');
  // const app = require('app');
  // const BrowserWindow = require('browser-window')
  
  function createWindow() {
    // Erstelle das Browser-Fenster.
    let win = new BrowserWindow({
      width: 800,
      height: 600,
      webPreferences: {
        nodeIntegration: true,
        contextIsolation: false
      },
    });
  
    // und lade die index.html der App.
    win.loadFile(&quot;index.html&quot;);
  }
  
  app.whenReady().then(() =&gt; {createWindow()});
  // app.on('ready',createWindow);
  </code></pre>
  <p>EDIT:
  when i try</p>
  <pre><code>const { app, BrowserWindow } = require('./node_modules/electron');
  </code></pre>
  <p>instead of</p>
  <pre><code>const { app, BrowserWindow } = require(&quot;electron&quot;);
  </code></pre>
  <p>the errormessage is still the same, but not in console of electron anymore but in console of terminal (node)</p>
  <p><a href="https://i.stack.imgur.com/xlbJ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xlbJ1.png" alt="enter image description here" /></a></p>
  <pre><code>{
    &quot;name&quot;: &quot;aurin&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;start&quot;: &quot;ng serve --open | node src/Backend/api.js&quot;,
      &quot;build&quot;: &quot;ng build&quot;,
      &quot;test&quot;: &quot;ng test&quot;,
      &quot;lint&quot;: &quot;ng lint&quot;,
      &quot;e2e&quot;: &quot;ng e2e&quot;,
      &quot;build-electron&quot;: &quot;ng build --base-href . &amp;&amp; cp src/electron/* dist/&quot;,
      &quot;electron&quot;: &quot;npm run build-electron &amp;&amp; ./node_modules/.bin/electron --no-sandbox dist/&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/cdk&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/common&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/compiler&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/core&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/forms&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/http&quot;: &quot;^6.1.10&quot;,
      &quot;@angular/material&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/platform-browser&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/router&quot;: &quot;^13.3.10&quot;,
      &quot;@coreui/angular&quot;: &quot;^4.0.1&quot;,
      &quot;@mdi/font&quot;: &quot;^6.7.96&quot;,
      &quot;colors&quot;: &quot;^1.4.0&quot;,
      &quot;core-js&quot;: &quot;^2.6.12&quot;,
      &quot;cron&quot;: &quot;^2.0.0&quot;,
      &quot;electron&quot;: &quot;^17.4.7&quot;,
      &quot;express&quot;: &quot;^4.18.1&quot;,
      &quot;hammerjs&quot;: &quot;^2.0.8&quot;,
      &quot;jquery&quot;: &quot;^3.6.0&quot;,
      &quot;luxon&quot;: &quot;^2.4.0&quot;,
      &quot;material-design-icons-iconfont&quot;: &quot;^6.7.0&quot;,
      &quot;mysql&quot;: &quot;^2.18.1&quot;,
      &quot;mysql-event-emitter&quot;: &quot;^1.0.8&quot;,
      &quot;mysql-events&quot;: &quot;0.0.11&quot;,
      &quot;ng-toast&quot;: &quot;^2.0.0&quot;,
      &quot;ng-toastr&quot;: &quot;^1.0.0&quot;,
      &quot;ngx-material-timepicker&quot;: &quot;^5.5.3&quot;,
      &quot;ngx-toastr&quot;: &quot;^14.3.0&quot;,
      &quot;node-schedule&quot;: &quot;^2.1.0&quot;,
      &quot;primeicons&quot;: &quot;^5.0.0&quot;,
      &quot;primeng&quot;: &quot;^13.4.1&quot;,
      &quot;rxjs&quot;: &quot;^7.5.5&quot;,
      &quot;save&quot;: &quot;^2.5.0&quot;,
      &quot;socket.io&quot;: &quot;^4.5.1&quot;,
      &quot;socket.io-client&quot;: &quot;^4.5.1&quot;,
      &quot;zone.js&quot;: &quot;~0.11.5&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@angular-devkit/build-angular&quot;: &quot;~13.2.6&quot;,
      &quot;@angular/cli&quot;: &quot;~13.2.6&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;^13.2.6&quot;,
      &quot;@angular/language-service&quot;: &quot;^13.2.6&quot;,
      &quot;@types/jasmine&quot;: &quot;~4.0.3&quot;,
      &quot;@types/jasminewd2&quot;: &quot;~2.0.10&quot;,
      &quot;@types/node&quot;: &quot;~17.0.36&quot;,
      &quot;codelyzer&quot;: &quot;~6.0.2&quot;,
      &quot;jasmine-core&quot;: &quot;~4.1.1&quot;,
      &quot;jasmine-spec-reporter&quot;: &quot;~7.0.0&quot;,
      &quot;karma&quot;: &quot;~6.3.20&quot;,
      &quot;karma-chrome-launcher&quot;: &quot;~3.1.1&quot;,
      &quot;karma-coverage-istanbul-reporter&quot;: &quot;~3.0.3&quot;,
      &quot;karma-jasmine&quot;: &quot;~5.0.1&quot;,
      &quot;karma-jasmine-html-reporter&quot;: &quot;^2.0.0&quot;,
      &quot;protractor&quot;: &quot;~7.0.0&quot;,
      &quot;ts-node&quot;: &quot;~10.8.0&quot;,
      &quot;tslint&quot;: &quot;~5.20.1&quot;,
      &quot;typescript&quot;: &quot;~4.6.4&quot;
    }
  }
  ```
  </code></pre>