Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From template=vite-typescript, run package error #3689

Closed
3 tasks done
XianZhengquan opened this issue Sep 10, 2024 · 3 comments
Closed
3 tasks done

From template=vite-typescript, run package error #3689

XianZhengquan opened this issue Sep 10, 2024 · 3 comments

Comments

@XianZhengquan
Copy link

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

run package error
image

Steps to reproduce

npm init electron-app@latest my-app -- --template=vite-typescript

run yarn package

Additional information

No response

@bdlr2
Copy link

bdlr2 commented Sep 10, 2024

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

> [email protected] 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
Copy link
Author

Got the fix here @bdlr2
electron/asar#325

@georgexu99
Copy link
Contributor

This can be resolved by upgrading electron/asar in the dependency tree 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants