Can't install Electron (Node version error)

Wappler Version : 6.7.1
Operating System : Ubuntu 22.04.4 LTS
Server Model:
Database Type:
Hosting Type:

Expected behaviour

Should be able to install Electron when the Node version is greater than the required version.

Error:

Screenshot from 2024-07-04 16-26-58

Node version is 20.15.0:

3

Wappler is showing:

Checking NodeJS installation and version...
v17.9.0
NodeJS is correctly installed.

Had to purge/prune Node as Wappler was using an older cached version.

Quick question @George Why does Wappler install a version of Node different to that of the host system? My system displays version 20.15.0 and and Wappler is using 22.4.0? And further, why did Wappler fall back on to a cached earlier version?

Oh well that success was short lived... Can not build despite tsc being installed:

tsc --version
Version 5.5.3
sh: 1: tsc: not found
Error packing your project for electron!

Well maybe there are multiple node versions installed on your system. Some with homebrew, others on system level.

Wappler puts path priority on homebrew so that is why those are found first.

As for tsc - don’t know for sure but it is project specific installation not system wide.

1 Like

Thanks for answering George much appreciated.

Should this not be checked/installed when a System Check is run on the Project?

tsc is just installed as dependency of capacitor / electron. So it is installed only locally for your project

Previously we built dozens of Electron applications in Wappler with no issues at all but we are seeing a whole lot of errors now.

We had to manually add tsc and init it in the console. Then we got multiple errors on packages not being included. Just working through that mess...

Found 11 errors in 4 files.

Errors  Files
     4  src/index.ts:3
     1  src/rt/electron-rt.ts:2
     5  src/setup.ts:7
     1  ../node_modules/@capacitor-community/electron/dist/core/ElectronSplashScreen.d.ts:1
Build error 2: 
> helloworld@1.0.0 build
> tsc && electron-rebuild

src/index.ts:3:49 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

3 import type { MenuItemConstructorOptions } from 'electron';
                                                  ~~~~~~~~~~

src/index.ts:4:31 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

4 import { app, MenuItem } from 'electron';
                                ~~~~~~~~~~

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/rt/electron-rt.ts:2:44 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

2 import { ipcRenderer, contextBridge } from 'electron';
                                             ~~~~~~~~~~

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

7 import chokidar from 'chokidar';
                       ~~~~~~~~~~

src/setup.ts:8:49 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

8 import type { MenuItemConstructorOptions } from 'electron';
                                                  ~~~~~~~~~~

src/setup.ts:9:80 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

9 import { app, BrowserWindow, Menu, MenuItem, nativeImage, Tray, session } from 'electron';
                                                                                 ~~~~~~~~~~

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/ElectronSplashScreen.d.ts:1:27 - error TS2307: Cannot find module 'electron' or its corresponding type declarations.

1 import type Electron from 'electron';
                            ~~~~~~~~~~


Found 11 errors in 4 files.

Errors  Files
     4  src/index.ts:3
     1  src/rt/electron-rt.ts:2
     5  src/setup.ts:7
     1  ../node_modules/@capacitor-community/electron/dist/core/ElectronSplashScreen.d.ts:1
⠙
Error building your project for electron!

Then got it down to:

Found 5 errors in 2 files.

Errors  Files
     2  src/index.ts:6
     3  src/setup.ts:7
Build error 2: 
> helloworld@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';
                                 ~~~~~~~~~~~~~~~~~~~~~~~


Found 5 errors in 2 files.

Errors  Files
     2  src/index.ts:6
     3  src/setup.ts:7
⠙
Error building your project for electron!

Fun times eh! :smiley:

Well you are getting there, see:

1 Like
✔ Rebuild Complete
electron build successfully!

Right there is my template for all future Electron Projects!

My terminal looks like a scene from Wargames!

:rofl:

1 Like

Wappler doesn't read PATH from shell profile file, I opened a bug report recently, that's why on terminal node version is different (my theory)

Well in the past we had too many problems with CLI tools not being found or with incorrect versions. So since we use homebrew to install those our selves, we alter the path to put homebrew in front.