Here's a weird problem I'm suffering for days.
I need to create an asar packed file, done with electron "asar" command, like this:
c:/asar pack app app.asar
That packs my "app" folder into a packed file "app.asar". Thats running OK.
The goal
I need to include this instruction inside my package.json script file in order to generate a build process, chainning other actions.
The problem:
Well, when I run this command, by package.json script like this c:/npm run create-asar
or either with a gulp-asar
process, it creates the app.asar file, but seems to be corrupted.
It can't be unpacked, process throws an error and can't be accessed by the electron app
I can't figure out why.
I've tried to run the exact same command from console, that in package.json, exactly the same, and both with the results above.
what's the difference?
versions info
- npm: v3.10.6
- node: v4.5.0
- asar: v0.13.0
- electron: v1.4.3
asar
as a project dependency. I.e.cd
to to project directory, runnpm i -D asar
to add it todevDependencies
inpackage.json
. Then update your npm-script to"create-asar": "node_modules/.bin/asar pack app app.asar"
. (Noteasar
is being run via the node_modules .bin folder). Then run$ npm run create-asar
and see if it unpacks successfully.