#289·electron

Cannot Pack a Fresh App

Author: HodesCreated Jun 4, 2024Updated Aug 10, 2024

Describe the bug I created a new app and added the platform template from this project. Then I attempted to build the project, but it resulted in an error by using the provided 'electron:pack' npm command.

To Reproduce

cd /tmp
ionic start # go through the installer, react, blank
npm i @capacitor-community/electron
ionic build
npx cap add @capacitor-community/electron
#npx cap open @capacitor-community/electron # works correctly
cd electron
npm run electron:pack #fails

Expected behavior It should probably not fail and generate the artifacts

Errors

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;
      ~~~~~~~~~~~~~~~~~~~~~~
.....

The list goes on...

Found 17 errors in 2 files.

Errors  Files
    16  node_modules/builder-util-runtime/out/httpExecutor.d.ts:9
     1  node_modules/chokidar/types/index.d.ts:9

Desktop:

  • OS: Fedora 40
  • Node: v20.12.2
  • In main project folder relevant package.json dependencies
    • "@capacitor-community/electron": "^5.0.1"
    • "@capacitor/core": "6.0.0",
  • In electron generated folder relevant package.json dependencies
"dependencies": {
  "@capacitor-community/electron": "^5.0.0",
  "chokidar": "~3.5.3",
  "electron-is-dev": "~2.0.0",
  "electron-serve": "~1.1.0",
  "electron-unhandled": "~4.0.1",
  "electron-updater": "^5.3.0",
  "electron-window-state": "^5.0.3"
},
"devDependencies": {
  "electron": "^26.2.2",
  "electron-builder": "~23.6.0",
  "electron-rebuild": "^3.2.9",
  "typescript": "^5.0.4"
}

Additional context I think the problem is 100% reproducible, maybe the current dependencies are outdated in the electron app template.

Thankyou !

Source: capacitor-community/electron