capacitor-community / capacitor-community/electron
Cannot Pack a Fresh App
- Dominant language
- TypeScript
- Stars
- 398
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
**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**
```bash
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**
```bash
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...
```bash
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
```json
"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 !
Contributor guide
Research direction
Start by reproducing the failure with `npm run electron:pack` in the generated `electron` folder, then inspect its package.json dependencies and the reported declarations in `node_modules/builder-util-runtime/out/httpExecutor.d.ts` and `node_modules/chokidar/types/index.d.ts`. Done means the fresh app's Electron template can run the packing command without these TypeScript errors and generates the expected artifacts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- build-system, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100