packager: --asar-unpack not working due to invalid glob syntax

I am trying to bundle an electron app that uses the node-notifier module. In order to get the node-notifier module to work, it has to be unpacked when doing asar. I have tried to use both asar-unpack and asar-unpack-dir to get it to work, but neither seems to be working.

The call I am trying to use is ./node_modules/electron-packager/cli.js . MyApp --platform=darwin --arch=x64 --version=0.36.0 --asar=true --asar-unpack="./node_modules/node-notifier/vendor/**" --overwrite --out dist/and it is working 100% as expected except for the unpacking.

However, running asar pack . app.asar --unpack "./node_modules/node-notifier/vendor/**" does work. I can even then replace the app.asar that electron-packager creates in the Resources folder (along with adding the app.asar.unpacked folder) and everything works as expected.

This is occurring in version 5.2.0 of electron-packager.

There are no errors that I can see that are shown when I try to use the unpack parameter. Everything seems to work fine, except that there is no app.asar.unpacked directory created within the electron app.

Steps to reproduce:

  1. Run ./node_modules/electron-packager/cli.js . MyApp --platform=darwin --arch=x64 --version=0.36.0 --asar=true --asar-unpack="./node_modules/node-notifier/vendor/**" --overwrite --out dist/ on an electron app
  2. Navigate to ./dist/MyApp-darwin-x64/MyApp.app/Contents/Resources
  3. Notice that app.asar has been created, but app.asar.unpacked has not been.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

It seems like it’s because asar uses absolute paths. This works:

electron-packager . BTCPlus --asar.unpack="**/node_modules/node-notifier/vendor/**"

@stormageddon Just solved exactly this issue – all you need to do is remove the β€œ./” in the node-notifier path, i.e.

--asar-unpack="node_modules/node-notifier/vendor/**"

not

--asar-unpack="./node_modules/node-notifier/vendor/**"