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

Cannot get asar-unpack to work #390

Closed
mikew opened this issue May 10, 2016 · 8 comments
Closed

Cannot get asar-unpack to work #390

mikew opened this issue May 10, 2016 · 8 comments
Labels

Comments

@mikew
Copy link

mikew commented May 10, 2016

Our Electron app uses convert from ImageMagick, and that needs some .xml files alongside the binary. Our electron folder ends up looking like this:

public/
├── external/
│   ├── colors.xml
│   ├── convert
│   ├── delegates.xml
│   └── magic.xml
├── app.css
├── app.js
├── electron-main.js
├── index.html
├── package.json
└── vendor.js

I'm able to run asar pack public/ public.asar --unpack 'public/external/*' and get both public.asar and public.asar.unpacked, but I cannot for the life of me figure out the path to be passed via build.asar-unpack in the development package.json.

I've tried ...

  "build": {
    "asar-unpack": "public/external/*"
  }
  "build": {
    "asar-unpack": "external/*"
  }
  "build": {
    "asar-unpack": "app/external/*"
  }
  "build": {
    "asar-unpack": "*/external/*"
  }
  "build": {
    "asar-unpack": "dist/ProductName-darwin-x64/Electron.app/Contents/Resources/app/external/*"
  }

... But am not able to get app.asar.unpacked. Is there anything I'm missing?

@mikew
Copy link
Author

mikew commented May 11, 2016

Ah, figured it out. Using a globstar works, and no matter your directory structure, your files will be under app/. The following works:

  "build": {
    "asar-unpack": "**/app/external/*"
  }

@mikew mikew closed this as completed May 11, 2016
@develar
Copy link
Member

develar commented May 11, 2016

It is the shame because we inherit this configuration option from the electron-packager. So, it is not smart and not user-friendly and no any checks :( So sad :( We will rework and introduce new smart option.

@develar
Copy link
Member

develar commented Jun 9, 2016

Fixed – now we correctly set cwdfor glob and relative patterns work. (it was bug in the asar).

Also you can use extraResources .

@develar develar closed this as completed Jun 9, 2016
@develar
Copy link
Member

develar commented Jun 9, 2016

Please note asar-unpack is deprecated, use asar as object of options.

@whyboris
Copy link

whyboris commented Feb 15, 2018

Thank you @mikew for also sharing your answer. In 2018 this worked:

"mac": {
  ...
  "target": "dmg",
  "asar": true,
  "asarUnpack": [
    "../node_modules/@ffmpeg-installer"
  ]
}

Successfully get this once the dmg is installed:

contents/
├── Resources/
│   ├── app.asar
│   └── app.asar.unpacked/
│       └── node_modules/
│           └── @ffmpeg-installer/

Now the tricky part is referring to it from within your app :trollface:
This hazardous workaround seems to work with basically 1 line of code: electron/electron#6262 (comment)

@challenger532
Copy link

challenger532 commented Feb 28, 2018

I have this problem:
screenshot from 2018-02-28 14-02-57

I tried this and it didn't work

   "asar": true,
   "asarUnpack": ["../node_modules/sqlite3"],

any idea?

@johnsilvester
Copy link

johnsilvester commented Mar 5, 2018

@challenger532 try changing:
"asarUnpack": ["../node_modules/sqlite3"],

to

"asarUnpack": ["node_modules/sqlite3"],

@devshridhar
Copy link

"asar": { "unpackDir": "src/move" },

    this worked for me. 

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

No branches or pull requests

6 participants