Ionic Deploy error when extracting

Hello,

I’ve updated my Ionic2 project to the latest version.
Since then I’ve got an issue with the deployment of the latest version.

I use Ionic Deploy, so I upload a new snapshot with data, that gets downloaded when the app starts, it will extract and the app restarts and its done.

This worked very well until the update. I can make new snapshots, upload them, they will be downloaded but when it try to extract it, the process will stop on 10/11% due an error.

I’m using the following versions:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:
Cordova CLI : 6.4.0

local packages:
@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.0.0 ios 4.3.1
Ionic Framework : ionic-angular 3.6.0

System:
ios-deploy : 1.9.0
Node : v6.11.1
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b

I could extract the error from de bug report window from the emulator, it says this:

I IONIC.DEPLOY.DOWNLOAD: Progress: 100%
W art     : Attempt to remove non-JNI local reference, dumping thread
I IONIC.DEPLOY.EXTRACT: Extracting update
I IONIC.DEPLOY.UNZIP: afd21148-370f-4da2-96dd-5b740348b915
I IONIC.DEPLOY.HASVER: Checking afd21148-370f-4da2-96dd-5b740348b915...
I IONIC.DEPLOY.HASVER: No
I IONIC.DEPLOY.UNZIP_DIR: /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915
I IONIC.DEPLOY.ENTRIES: Total: 42
I IONIC.DEPLOY.EXTRACT: Progress: 2%
I IONIC.DEPLOY.EXTRACT: Progress: 4%
I IONIC.DEPLOY.EXTRACT: Progress: 7%
I IONIC.DEPLOY.EXTRACT: Progress: 9%
I IONIC.DEPLOY.EXTRACT: Progress: 11%
I IONIC.DEPLOY.UNZIP_STEP: Exception: /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915/build/0.js (Not a directory)
I IONIC.DEPLOY.REMOVE: Removed www.zip
W art     : Attempt to remove non-JNI local reference, dumping thread
D SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 86390 : Ionic Deploy: download complete
I chromium: [INFO:CONSOLE(86390)] "Ionic Deploy: download complete", source: file:///android_asset/www/build/main.js (86390)
W art     : Attempt to remove non-JNI local reference, dumping thread
D SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 79029 : EXCEPTION: Uncaught (in promise): /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915/build/0.js (Not a directory)
I chromium: [INFO:CONSOLE(79029)] "EXCEPTION: Uncaught (in promise): /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915/build/0.js (Not a directory)", source: file:///android_asset/www/build/main.js (79029)
D SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 79034 : ORIGINAL STACKTRACE:
I chromium: [INFO:CONSOLE(79034)] "ORIGINAL STACKTRACE:", source: file:///android_asset/www/build/main.js (79034)
D SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 79035 : Error: Uncaught (in promise): /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915/build/0.js (Not a directory)
D SystemWebChromeClient:     at s (file:///android_asset/www/build/polyfills.js:3:4211)
D SystemWebChromeClient:     at s (file:///android_asset/www/build/polyfills.js:3:4034)
D SystemWebChromeClient:     at file:///android_asset/www/build/polyfills.js:3:4574
D SystemWebChromeClient:     at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9723)
D SystemWebChromeClient:     at Object.onInvokeTask (file:///android_asset/www/build/main.js:58721:37)
D SystemWebChromeClient:     at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9659)
D SystemWebChromeClient:     at e.runTask (file:///android_asset/www/build/polyfills.js:3:7083)
D SystemWebChromeClient:     at i (file:///android_asset/www/build/polyfills.js:3:3671)
I chromium: [INFO:CONSOLE(79035)] "Error: Uncaught (in promise): /data/user/0/[APPNAME]/app_afd21148-370f-4da2-96dd-5b740348b915/build/0.js (Not a directory)
I chromium:     at s (file:///android_asset/www/build/polyfills.js:3:4211)
I chromium:     at s (file:///android_asset/www/build/polyfills.js:3:4034)
I chromium:     at file:///android_asset/www/build/polyfills.js:3:4574
I chromium:     at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9723)
I chromium:     at Object.onInvokeTask (file:///android_asset/www/build/main.js:58721:37)
I chromium:     at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:9659)
I chromium:     at e.runTask (file:///android_asset/www/build/polyfills.js:3:7083)
I chromium:     at i (file:///android_asset/www/build/polyfills.js:3:3671)", source: file:///android_asset/www/build/main.js (79035)

Right there its saying your path is wrong, I believe. I had this issue recently and what fixed it was running
npm install promise-polyfill --save-exact.

Source:angularjs - ERROR in ./~/firebase/app/shared_promise.js - Stack Overflow

Thanks, will try that right away!
EDIT: I’ve tested it, but this is not the solution.

Anyone? I’m really stuck here…

I am also having trouble with the deploy on Android devices. I am using “ionic-plugin-deploy”: “^0.6.7”. I tried the npm install promise-polyfil but it did not help. Here is the error:

Error extracting update: /data/user/0/[APP_NAME]/app_fd3a6f14-e45d-4f6a-bc0c-7d4ee03d457e/assets/data: open failed: ENOTDIR (Not a directory)

1 Like

Did you manage to fix it?

This is old and should be updated to Cordova 7.0.1.

Also what version of the deploy plugin do you have installed?

Yes, I fixed it with this pull request https://github.com/ionic-team/ionic-plugin-deploy/pull/132 from @ztecharoberts.
Also take a look at this comment: https://github.com/ionic-team/ionic-plugin-deploy/issues/130#issuecomment-327061100

I updated to cordova 7.0.1 but it didnt fix it.

How can i get the versions of the installed plugins?
edit: I found it, my config.xml says ‘~0.6.7’

How do i install a plugin from a private repo? SO i can use your version of the deploy plugin

Check the package.json or run ionic cordova plugin list

Okay well, i use version 0.6.7.

@reggierodriguesjr posted the probably reason and also possible solutions.

So I tried something:
When I install latest version of Cordova CLI (7.0.1) and Ionic CLI (3.9.2) my deploys don’t work anymore.

When I install lateste version of Cordova CLI (7.0.1) and older version of Ionic CLI (2.1.18) the deploy does work!

No that doesn’t fix anything, the PR is not merged, it’s closed by the author without any comment or so.

The #130 is still open and latest comment says that it’s still a persistent problem.

What I did was look at the code changes in the pull request. Since they were minor I just copied and pasted the changes in my local platforms/android/src/io/ionic/deploy/IonicDeploy.java. I ran a build and the deploy worked as expected. I am hoping in the next release of the deploy plugin this will be merged and I won’t have to manually update the code. Hope this helps.

1 Like

I am not sure if there ever will be another release of the old Ionic Deploy plugin as there is a wholly new Ionic Deploy system with the new Ionic Pro: http://ionicframework.com/products/#updates + https://ionic.zendesk.com/hc/en-us/sections/115003254547-Ionic-Deploy It uses a new plugin (that hopefully won’t have the same problems). Here is a migration guide: https://ionic.zendesk.com/hc/en-us/articles/115011853787-Migrating-Live-Deploy

That doesn’t work for me.

That is good to know. Thank you for the info.

You can use the locally modified version of the code. It works, you just can’t create a completely new checkout of your app and build from it without applying these modifications.

You can also create a fork of the original plugin, apply the PR on your fork and install the fork instead of the version from NPM.