electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

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

Open andirsun opened this issue 2 years ago • 2 comments

  • Electron-Builder Version: last
  • Node Version: 16
  • Electron Version:
  • 17.4
  • Electron Type (current, beta, nightly):
  • Target: mac os universal

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.

> [email protected] 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 ?

  • This is the content of the unpacked resources Captura de Pantalla 2022-06-03 a la(s) 5 25 24 p m

photo4958589268956130044

andirsun avatar Jun 03 '22 22:06 andirsun

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

burgil avatar Jun 05 '22 20:06 burgil

Same result @burgil

andirsun avatar Jun 17 '22 00:06 andirsun

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

hrueger avatar Sep 26 '22 05:09 hrueger

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}"
  ],
  ...

andirsun avatar Oct 06 '23 14:10 andirsun