Electron: Chokidar module missing

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

Bump

I’m still stuck in this

The team are at the WebSummit so won’t be as available as usual. I ran into the same problem when trying to use Capacitor and Electron. I made a project using capacitor instead which seems to be much easier to get up and running.

Try running npx cap update electron in the console from the project directory.

  • 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

Still looking for a solution

Bump @patrick

Go into the electron folder and run npm install there.

1 Like

It is working now. But this is all that I can see:

A blank page.

I don’t know if it’s related or not.

Electron has devtools, you can use it to inspect the application. Is there any html or perhaps some error in the console?

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:

The app folder should be a copy of the www folder. Is the routes.js available within the www or was it perhaps never included. Have you tested it in the browser?

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

Did you build the app image before running it, it should copy all files from the www folder to the app folder. I see it is also missing the capacitor.js and page1.html and maybe even more.

We found out that the build from electron does not sync the folders, we will have this fixed in the next update. Go to the terminal and type npx cap sync electron, then it should have the new files in the electron app.

1 Like

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?