相关文章推荐
淡定的盒饭  ·  Electron webview 标签 - ...·  4 月前    · 
玩滑板的凉面  ·  MySQL ...·  3 年前    · 
稳重的蟠桃  ·  Mysql8 和mysql 5.7 ...·  3 年前    · 
文质彬彬的香槟  ·  javascript - Safari ...·  3 年前    · 

Can’t find a way to start my first electron app. I looked up on internet but nothing seems to work for me.

  • Opening Electron platform
  • Opening Electron platform: start :rocket:
    :information_source: Opening Electron platform: start :rocket:
  • Opening Electron platform: builing electron app
    :information_source: Opening Electron platform: builing electron app
  • Opening Electron platform: running electron app
    Error: undefined
    :heavy_multiplication_x: Opening Electron platform:
    node:internal/process/promises:279
    triggerUncaughtException(err, true /* fromPromise */);

    [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise whic
    h was not handled with .catch(). The promise rejected with the reason "

    capacitor-app@1.0.0 electron:start-live
    node ./live-runner.js

    node:internal/modules/cjs/loader:936
    throw err;

    Error: Cannot find module ‘chokidar’
    Require stack:

  • C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js:4:18)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js’
    ".] {
    code: ‘ERR_UNHANDLED_REJECTION’

    Update: I also noticed, if I try to build the app, it throws another error.

    capacitor-app@1.0.0 build
    tsc && electron-rebuild

    src/index.ts:6:23 - error TS2307: Cannot find module ‘electron-unhandled’ or its corresponding type declarations.

    6 import unhandled from ‘electron-unhandled’;
    ~~~~~~~~~~~~~~~~~~~~

    src/index.ts:7:29 - error TS2307: Cannot find module ‘electron-updater’ or its corresponding type declarations.

    7 import { autoUpdater } from ‘electron-updater’;
    ~~~~~~~~~~~~~~~~~~

    src/setup.ts:7:22 - error TS2307: Cannot find module ‘chokidar’ or its corresponding type declarations.

    7 import chokidar from ‘chokidar’;
    ~~~~~~~~~~

    src/setup.ts:11:27 - error TS2307: Cannot find module ‘electron-serve’ or its corresponding type declarations.

    11 import electronServe from ‘electron-serve’;
    ~~~~~~~~~~~~~~~~

    src/setup.ts:12:31 - error TS2307: Cannot find module ‘electron-window-state’ or its corresponding type declarations.

    12 import windowStateKeeper from ‘electron-window-state’;
    …/node_modules/ @capacitor-community /electron/dist/core/util.d.ts:1:23 - error TS4090: Conflicting definitions for ‘node’ found at ‘C:/Users/Fractal/D
    ocuments/Wappler/melilliprints/node_modules/ @types /node/ts4.8/index.d.ts’ and ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/electron/
    node_modules/ @types /node/ts4.8/index.d.ts’. Consider installing a specific version of this library to resolve the conflict.
    The file is in the program because:
    Type library referenced via ‘node’ from file ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/electron/electron.d.ts’ with packageId
    @types /node/ts4.8/index.d.ts@16.18.3’
    Type library referenced via ‘node’ from file ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/ @capacitor-community /electron/dist/cor
    e/util.d.ts’ with packageId ‘ @types /node/ts4.8/index.d.ts@18.11.8’

    1 ///

    …/node_modules/electron/electron.d.ts:6:23
    6 ///
    File is included via type library reference here.

    Found 6 errors in 3 files.

    Errors Files
    2 src/index.ts:6
    3 src/setup.ts:7
    1 …/node_modules/ @capacitor-commun

  • Opening Electron platform
  • Opening Electron platform: start :rocket:
    :information_source: Opening Electron platform: start :rocket:
  • Opening Electron platform: builing electron app
    :information_source: Opening Electron platform: builing electron app
  • Opening Electron platform: running electron app
    Error: undefined
    :heavy_multiplication_x: Opening Electron platform:
    node:internal/process/promises:279
    triggerUncaughtException(err, true /* fromPromise */);

    [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise whic
    h was not handled with .catch(). The promise rejected with the reason "

    capacitor-app@1.0.0 electron:start-live
    node ./live-runner.js

    node:internal/modules/cjs/loader:936
    throw err;

    Error: Cannot find module ‘chokidar’
    Require stack:

  • C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js:4:18)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘C:\Users\Fractal\Documents\Wappler\melilliprints\electron\live-runner.js’
  • capacitor-app@1.0.0 build
    tsc && electron-rebuild

    src/index.ts:6:23 - error TS2307: Cannot find module ‘electron-unhandled’ or its corresponding type declarations.

    6 import unhandled from ‘electron-unhandled’;
    ~~~~~~~~~~~~~~~~~~~~
    src/index.ts:7:29 - error TS2307: Cannot find module ‘electron-updater’ or its corresponding type declarations.

    7 import { autoUpdater } from ‘electron-updater’;
    ~~~~~~~~~~~~~~~~~~

    src/setup.ts:7:22 - error TS2307: Cannot find module ‘chokidar’ or its corresponding type declarations.

    7 import chokidar from ‘chokidar’;
    ~~~~~~~~~~

    src/setup.ts:11:27 - error TS2307: Cannot find module ‘electron-serve’ or its corresponding type declarations.

    11 import electronServe from ‘electron-serve’;
    ~~~~~~~~~~~~~~~~

    src/setup.ts:12:31 - error TS2307: Cannot find module ‘electron-window-state’ or its corresponding type declarations.

    12 import windowStateKeeper from ‘electron-window-state’;
    ~~~~~~~~~~~~~~~~~~~~~~~

    …/node_modules/ @capacitor-community /electron/dist/core/util.d.ts:1:23 - error TS4090: Conflicting definitions for ‘node’ found at ‘C:/Users/Fractal/D
    ocuments/Wappler/melilliprints/node_modules/ @types /node/ts4.8/index.d.ts’ and ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/electron/
    node_modules/ @types /node/ts4.8/index.d.ts’. Consider installing a specific version of this library to resolve the conflict.
    The file is in the program because:
    Type library referenced via ‘node’ from file ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/electron/electron.d.ts’ with packageId
    @types /node/ts4.8/index.d.ts@16.18.3’
    Type library referenced via ‘node’ from file ‘C:/Users/Fractal/Documents/Wappler/melilliprints/node_modules/ @capacitor-community /electron/dist/cor
    e/util.d.ts’ with packageId ‘ @types /node/ts4.8/index.d.ts@18.11.8’

    1 ///

    …/node_modules/electron/electron.d.ts:6:23
    6 ///
    File is included via type library reference here.

    Found 6 errors in 3 files.

    Errors Files
    2 src/index.ts:6
    3 src/setup.ts:7
    1 …/node_modules/ @capacitor-community /electron/dist/core/util.d.ts:1
    Error building your project for electron!

    @patrick

    I decided to test how ready Electron is for production in Wappler, but I also ran into a problem during assembly - there is no router file in the Electron assembly:

    Everything is fine in the www folder:

    The interface works fine in the browser. Routing works.

    Most likely this is a bug. Created another new project and the same error. Wappler version 5.2.4

    Hi @patrick - I’m on W5.3.3 and get the same errors as reported above when trying to build/run for Electron in Capacitor:

    > tsc && electron-rebuild src/index.ts:6:23 - error TS2307: Cannot find module 'electron-unhandled' or its corresponding type declarations. 6 import unhandled from 'electron-unhandled'; ~~~~~~~~~~~~~~~~~~~~ src/index.ts:7:29 - error TS2307: Cannot find module 'electron-updater' or its corresponding type declarations. 7 import { autoUpdater } from 'electron-updater'; ~~~~~~~~~~~~~~~~~~ src/setup.ts:7:22 - error TS2307: Cannot find module 'chokidar' or its corresponding type declarations. 7 import chokidar from 'chokidar'; ~~~~~~~~~~ src/setup.ts:11:27 - error TS2307: Cannot find module 'electron-serve' or its corresponding type declarations. 11 import electronServe from 'electron-serve'; ~~~~~~~~~~~~~~~~ src/setup.ts:12:31 - error TS2307: Cannot find module 'electron-window-state' or its corresponding type declarations. 12 import windowStateKeeper from 'electron-window-state'; ~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/@capacitor-community/electron/dist/core/util.d.ts:1:23 - error TS4090: Conflicting definitions for 'node' found at '/Users/ben/Library/Mobile Documents/com~apple~CloudDocs/Wappler/XX/F7apps/XXCapacitorF7_v1/node_modules/@types/node/ts4.8/index.d.ts' and '/Users/XX/node_modules/@types/node/ts4.8/index.d.ts'. Consider installing a specific version of this library to resolve the conflict. The file is in the program because: Type library referenced via 'node' from file '/Users/XX/node_modules/electron/electron.d.ts' with packageId '@types/node/ts4.8/index.d.ts@16.11.62' Type library referenced via 'node' from file '/Users/XX/Library/Mobile Documents/com~apple~CloudDocs/Wappler/club_ed/F7apps/clubedCapacitorF7_v1/node_modules/@capacitor-community/electron/dist/core/util.d.ts' with packageId '@types/node/ts4.8/index.d.ts@18.11.18' 1 /// <reference types="node" /> ../../../../../../../../node_modules/electron/electron.d.ts:6:23 6 /// <reference types="node" /> File is included via type library reference here. Found 6 errors in 3 files. Errors Files 2 src/index.ts:6 3 src/setup.ts:7 1 ../node_modules/@capacitor-community/electron/dist/core/util.d.ts:1 Error running your project for electron!

    Do I need to open a new bug report?