Electron-builder: Incorrect zip files on MacOS

Created on 10 Dec 2018  路  4Comments  路  Source: electron-userland/electron-builder

  • Version: 20.38.2

  • npm: 6.4.1

  • node: 10.13.0

  • Target: MacOS

Electron-builder seems to produce incorrect zip files. yauzl throws error like this:

> Error: invalid comment length. expected: 53819. found: 0
    at /Users/maciej/project/node_modules/yauzl/index.js:133:25
    at /Users/maciej/project/node_modules/yauzl/index.js:631:5
    at /Users/maciej/project/node_modules/node_modules/fd-slicer/index.js:32:7
    at FSReqWrap.wrapper [as oncomplete] (fs.js:460:17)

when trying to unzip generated files. On electron-builder@<=20.28.4 this was not the case.

Comment on yauzl related to this problem: https://github.com/thejoshwolfe/yauzl/issues/48#issuecomment-266587526

Probably the change of behavior was introduced in this commit: https://github.com/electron-userland/electron-builder/commit/a6c5bc4a#diff-3c6dfae80290537b7e199091b6944fdaR60

bug mac

Most helpful comment

Yes the zip file that electron-builder@>=20.38.2 produces for MacOS is corrupted according to strict ZIP archivers. I've gotten around this for now by embedding 7z binaries with my application.

This is due to electron-builder trying to embed blockmap information into the archive. This "corrupts" the zip file.

All 4 comments

You may update to the latest version of electron-builder. I had a similar problem when downloading the electron zip file and a yarn upgrade solved my problem.

Thank you for your response :)

Unfortunately, the problem persists on 20.38.3.

To make things clear, there is no problem with electron zip, but with the ZIP file with the electron app produced by electron-builder.

Oh, and by the way we are using [email protected]. The app itself is built correctly, but the ZIP file seems to be corrupted according to more strict ZIP archivers like yauzl.

Yes the zip file that electron-builder@>=20.38.2 produces for MacOS is corrupted according to strict ZIP archivers. I've gotten around this for now by embedding 7z binaries with my application.

This is due to electron-builder trying to embed blockmap information into the archive. This "corrupts" the zip file.

Was this page helpful?
0 / 5 - 0 ratings