ionic-cli: ionic build --release browser generates broken zip archive

How to reproduce:

  • ionic start myApp maps
  • cd myApp
  • ionic platform add browser
  • ionic build --release browser
  • zip -T platforms/browser/build/package.zip

Error:

error:  invalid compressed data to inflate ./lib/ionic/fonts/ionicons.ttf
test of platforms/browser/build/package.zip FAILED

We want to build CI system for our ionic app, but we can`t because exit code of unzip process is not zero.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 19

Most upvoted comments

FYI this is not an ionic bug, rather than Cordova-browser bug. In order to have not broken zip archive you can install the patched version from this PR https://github.com/apache/cordova-browser/pull/25

IDK why the original maintainers haven’t fixed it yet.

+1

I also have this problem

I’m seeing something similar, mostly affecting a selection of images. It’s consistently affecting the same images, which I’ve attached, though I’m not sure if it’s the images, or their position in the zip which has problems.

Platform: Ubuntu 14.04, Ionic 1.5.5, zip 3.0 (Info-ZIP), unzip 6.00 Debian / Info-ZIP.

james@tower:~/Code/App$ zip -T platforms/browser/build/package.zip
  error:  invalid compressed data to inflate ./css/fonts/ionicons.eot
  error:  invalid compressed data to inflate ./img/default-dish-icon.png
  error:  invalid compressed data to inflate ./img/default-outlet-icon.png
  error:  invalid compressed data to inflate ./img/fhrs-images/FHIS/fhis_improvement_required.jpg
  error:  invalid compressed data to inflate ./img/fhrs-images/FHRS/fhrs_0_en-gb.jpg
  error:  invalid compressed data to inflate ./img/fhrs-images/FHRS/fhrs_4_en-gb.jpg
  error:  invalid compressed data to inflate ./img/fhrs-images/FHRS/fhrs_5_en-gb.jpg
  error:  invalid compressed data to inflate ./img/map/sprites.png
test of platforms/browser/build/package.zip FAILED

zip error: Zip file invalid, could not spawn unzip, or wrong unzip (original files unmodified)

I’ve attached both img/fhrs-images/FHRS/fhrs_0_en-gb.jpg and img/fhrs-images/FHRS/fhrs_1_en-gb.jpg - 0 fails, 1 has no problems (as well as many others) - in case they help. fhrs_0_en-gb fhrs_1_en-gb

If I try and access 0 directly from my archive manager, it fails, despite showing the correct file size. Once extracted, these problem files are all 0 bytes.

If I create a manual archive of platforms/browser/www, I can open the problem images fine. Zip -T also reports no problems:

james@tower:~/Code/App$ zip -T platforms/browser/www/www.zip 
test of platforms/browser/www/www.zip OK

Workaround: This might help for now in a CI context: I’ve found that zipping platforms/browser/www (right click, compress in Nautilus) fixes the problems - the problem files now have data when unzipped, as does:

james@tower:~/Code/App$ cd platforms/browser/www
james@tower:~/Code/App$ zip -r ../build/package.zip .
james@tower:~/Code/App$ zip -T ../build/package.zip
test of build/package.zip OK

And this also works when extracted, though is about 3x the size - I guess I forgot a compression switch, and there’ll be some stale caches hanging around for a bit unless you’re busting them.