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

Created on 18 Mar 2016  路  17Comments  路  Source: electron/electron-packager

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.

asar question

Most helpful comment

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

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

All 17 comments

Could you write a failing testcase for this? It would help whoever works on fixing this bug.

@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/**"

If that's the answer, then I'm changing this from a bug to a (solved) question.

Not working. Ive tried like every possible way to unpack,
"electron-packager . BTCPlus --asar=true --asar-unpack=\"/node_modules/node-notifier/vendor/**\""

As of version 8.0.0 it should look something like

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

Please keep in mind that an issue that was last commented on 2 years ago may not be accurate anymore since the major version of Electron Packager has changed several times.

Yeah Im looking at their npm page, It says --unpack-dir but thats not working either, Ill give this a try.

Nope.

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

Did not work.

Im looking at their npm page, It says --unpack-dir but thats not working either

What NPM page?

Did not work.

I mistyped, I think you need to remove the leading slash:

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

If you need more assistance, please use one of the community forums. The issue tracker is primarily used for bug reports and feature requests.

I believe i tried every alternative, Will give that another go. I have opened the issue with asar, I appreciate the kind replies and you remaining tolerant.

And the npm page for asar.

But yes just to confirm for you, The method provided, still does not work.

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

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

Thank you so much man.

However the icon is still not appearing for node-notifier :(

If you need more assistance, please use one of the community forums. Support for node-notifier is outside the scope of this issue tracker.

Yeah IM going back to their issue, Thanks again.

Hi,
Can anyone help me .. I tried all the mentioned above techniques nothing works for me ..
electron-packager . --overwrite --asar --asar-unpack-dir=unpack --asar-unpack=\"**/src/engine/**\" --platform=win32 --arch=ia32 --icon=src/images/vuejs.ico --prune=true --out=release-builds

I'm keeping a JAR file inside the engine .. Which should be unpacked so that I can run it.
Added the above line as a script in package.json

Is there anything wrong in this ? Please help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  4Comments

leanderBehr picture leanderBehr  路  3Comments

Orrison picture Orrison  路  3Comments

caishengmao picture caishengmao  路  3Comments

akcorp2003 picture akcorp2003  路  4Comments