From template=vite-typescript, run package error
XianZhengquan opened this issue · 3 comments
XianZhengquan commented
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.4.0
Electron version
32.0.2
Operating system
macOS 14.6.1
Last known working Electron Forge version
No response
Expected behavior
run package success
Actual behavior
Steps to reproduce
npm init electron-app@latest my-app -- --template=vite-typescript
run yarn package
Additional information
No response
bdlr2 commented
Exact same issue with template webpack-typescript.
Trying to build for Linux ARM64.
I suspect the reason is the bump from dependency @electron/asar v3.2.10 to 3.2.11
Temporary fix is to add these lines to package.json
"overrides": {
"@electron-forge/cli" : {
"@electron-forge/core" : {
"@electron/packager": {
"@electron/asar": "3.2.10"
}
}
}
}
Log:
node@7c67c5e7da0f:~$ npm init electron-app@latest my-new-app -- --template=webpack-typescript
> npx
> create-electron-app my-new-app --template=webpack-typescript
✔ Locating custom template: "webpack-typescript"
✔ Initializing directory
✔ Preparing template
✔ Initializing template
✔ Installing template dependencies
node@7c67c5e7da0f:~$ cd ./my-new-app/
node@7c67c5e7da0f:~/my-new-app$ npm run package -- --platform=linux --arch=arm64
> my-new-app@1.0.0 package
> electron-forge package --platform=linux --arch=arm64
✔ Checking your system
✔ Running generateAssets hook
✔ Preparing to package application
✔ Running packaging hooks
✔ Running generateAssets hook
✔ Running prePackage hook
✔ [plugin-webpack] Preparing webpack bundles
✔ Preparing native dependencies [0.4s]
✔ Building webpack bundles [7s]
❯ Packaging application
❯ Packaging for arm64 on linux
✔ Copying files
✔ Preparing native dependencies [26s]
✖ Finalizing package
› Cannot read properties of undefined (reading 'createPackageWithOptions')
◼ Running postPackage hook
An unhandled rejection has occurred inside Forge:
TypeError: Cannot read properties of undefined (reading 'createPackageWithOptions')
at LinuxApp.asarApp (/home/node/my-new-app/node_modules/@electron/packager/src/platform.ts:248:16)
at async LinuxApp.buildApp (/home/node/my-new-app/node_modules/@electron/packager/src/platform.ts:153:5)
at async LinuxApp.initialize (/home/node/my-new-app/node_modules/@electron/packager/src/platform.ts:144:7)
at async LinuxApp.create (/home/node/my-new-app/node_modules/@electron/packager/src/linux.ts:14:5)
at async Promise.all (index 0)
at async packager (/home/node/my-new-app/node_modules/@electron/packager/src/packager.ts:246:20)
XianZhengquan commented
Got the fix here @bdlr2
electron/asar#325
georgexu99 commented
This can be resolved by upgrading electron/asar
in the dependency tree 🙇