electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.6k stars 1.73k forks source link

Cannot find module '@resvg/resvg-js-darwin-arm64' when compiling universal app #6919

Closed andirsun closed 11 months ago

andirsun commented 2 years ago

I am using resvg library that offers binaries for all OSes including m1 arm64, the problem is that electron builder is not detecting the library when I am compiling the app for universal architecture and only include the library x64 version in the ASAR, the result when I test the app on m1 mac is that library is missing.

> streamline@4.0.17 pack:mac
> electron-builder --mac

  • electron-builder  version=23.0.9 os=21.5.0
  • loaded configuration  file=/Users/julianacaromoreno/projects/streamline-web/electron-builder.yml
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=arm64 electron=17.4.6 appOutDir=dist/mac-arm64
  • signing         file=dist/mac-arm64/Streamline.app identityName=Developer ID Application: Webalys, LLC (U7XNJG59LL) identityHash=D67BA83C59353EA2BB7501103EB25119DCBDF921 provisioningProfile=none
  • building        target=macOS zip arch=arm64 file=dist/Streamline.zip
  • building        target=DMG arch=arm64 file=dist/Streamline.dmg
  • building block map  blockMapFile=dist/Streamline.zip.blockmap

How can I force electron builder to download the arm64 binary of the library ?

photo4958589268956130044

burgil commented 2 years ago

Hey, Try the solution I just posted on another similar issue: https://github.com/electron-userland/electron-builder/issues/6928#issuecomment-1146870701

andirsun commented 2 years ago

Same result @burgil

hrueger commented 1 year ago

see https://github.com/yisibl/resvg-js/issues/153

andirsun commented 11 months ago

Fixed with this, the solution is to exclude C/C++ Files from the asar pack In my case:

  ...
  "files": [
    "!node_modules/**/*.{mk,a,o,h}"
  ],
  ...