Error in new project using Electron

This error occurred in a mobile project. Created in version 6.0.5.

Absolutely nothing was done before, we just created the file and added electron to the project.

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\r_bnt\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\r_bnt\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\r_bnt\AppData\Local\npm-cache_logs\2023-12-26T19_41_27_453Z-debug-0.log
Error running your project for electron!

What can be done?

Seems like NodeJS is not installed correctly, do a clean install by downloading the latest lts version from https://nodejs.org/en

After reinstalling the node, a new error occurred.

helloworld@1.0.0 electron:start
npm run build && electron --inspect=5858 ./

helloworld@1.0.0 build
node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“accept-charset”’ of type ‘string | string’ is not assignable
to ‘string’ index type ‘string’.

9 [key: string]: string;
node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“accept-encoding”’ of type ‘string | string’ is not assignable
to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“accept-language”’ of type ‘string | string’ is not assignable
to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“content-length”’ of type ‘string | number’ is not assignable to
‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“proxy-authenticate”’ of type ‘string | string’ is not assigna
ble to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“sec-websocket-extensions”’ of type ‘string | string’ is not a
ssignable to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“sec-websocket-protocol”’ of type ‘string | string’ is not ass
ignable to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“set-cookie”’ of type ‘string | string’ is not assignable to ’
string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘“www-authenticate”’ of type ‘string | string’ is not assignabl
e to ‘string’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘accept’ of type ‘string | string’ is not assignable to 'string
’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘connection’ of type ‘string | string’ is not assignable to ‘st
ring’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘cookie’ of type ‘string | string’ is not assignable to 'string
’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘dav’ of type ‘string | string’ is not assignable to ‘string’ i
ndex type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘link’ of type ‘string | string’ is not assignable to ‘string’
index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘prgama’ of type ‘string | string’ is not assignable to 'string
’ index type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

node_modules/builder-util-runtime/out/httpExecutor.d.ts:9:5 - error TS2411: Property ‘via’ of type ‘string | string’ is not assignable to ‘string’ i
ndex type ‘string’.

9 [key: string]: string;
~~~~~~~~~~~~~~~~~~~~~~

Found 16 errors in the same file, starting at: node_modules/builder-util-runtime/out/httpExecutor.d.ts:9

Error running your project for electron!

I’m having the same issue here; everything I try to do beyond a web project doesn’t work without having to solve a bunch of problems, and most of the time I can’t resolve them.

yes this is unfortunately a bug with the latest Capacitor Electron:

you can easily bypass it by adding "skipLibCheck":true in the tsconfig.json file in the electron folder

1 Like