app.whenReady().then(() => { TypeError: Cannot read properties of undefined (reading 'whenReady')

发布时间:2023-08-11 10:36:49
app.whenReady().then(() => {
    ^

TypeError: Cannot read properties of undefined (reading 'whenReady')
    at Object.<anonymous> (/electron-quick-start/main.js:25:5)
    at Module._compile (node:internal/modules/cjs/loader:1269:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1324:10)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:87:12)
    at node:internal/main/run_main_module:23:47

在开发项管的时候,随着项目越来越大,于是开始使用外部终端来启动项目,在搭建electron时于是也使用外部终端启动, 于是出现以上的错误。换成vscode的终端启动于是就解决了。

使用搭建的代码

https://github.com/electron/electron-quick-start

Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为