ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Ionic Deploy: can't extract update in CLI v3

Open jgw96 opened this issue 9 years ago • 10 comments

From @decpio on May 15, 2017 12:49

Ionic version: (check one with "x") [ ] 1.x [ ] 2.x [x] 3.x

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request =>

Current behavior: After 'ionic upload' when you programically check for update using 'ionic deploy plugin' you have this error: /data/user/0/com.ionicframework.mayAppName/app_GUID/ ./build/sw-toolbox.js: open failed: ENOTDIR (Not a directory) and installation stops. After build command, generated apk works fine, but uploaded to cload can't intall.

Expected behavior: work fine without error

Steps to reproduce:

Related code: run manually this function: private checkForUpdates() { this.__Deploy.check().then((snapshotAvailable: boolean) => { if (snapshotAvailable) { this.__Deploy.download().then(() => { // If a new snapshot is available, you can download and extract it, which will set it as the active snapshot. The next time the app is loaded, the new snapshot will be used. return this.__Deploy.extract().then(() => { // After extract() resolves, you can optionally force an immediate app restart using load().

                            setTimeout(() => {
                                this.__Deploy.load();
                            }, 10 * 1000);
                        }).catch(reason => {
                           // >> here extraction error apear !!! <<
                        });
                    }).catch(reason => {
                    });
                }
                else { // no snapshot available
                }
            }).catch(reason => {
            });
        }
    }
}

Other information: app is installed on device from apk, and then aupdates are downloaded from ionic cload. Earlier works fine: I mean before such changes:

  • I updated ionic CLI to v3
  • I implemented 'lazy load' to page files. Booth changes was made in same time. I don't know which change broke installation.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

λ ionic info

global packages:

@ionic/cli-utils : 1.0.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.0.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework                 : ionic-angular 3.2.1

System:

Node       : v6.9.4
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

Copied from original issue: driftyco/ionic#11673

jgw96 avatar May 15 '17 14:05 jgw96

@decpio Could you temporarily downgrade back to Ionic CLI v2.2.3 to see if this is caused by Ionic CLI v3? Thanks.

janpio avatar May 15 '17 16:05 janpio

Duplicate: https://github.com/driftyco/ionic-cli/issues/2237

See https://github.com/driftyco/ionic-plugin-deploy/issues/122

The deploy plugin must be updated to v0.6.7.

imhoffd avatar May 15 '17 20:05 imhoffd

Someone closed this issue because other one is similar: I have deploy plugin 0.6.7 and I still have problem with CLIv3.

That was done:

· npm uninstall ionic –g

· npm install [email protected] –g

· ionic build android --prod –release

· ionic upload --note "stable # ver 3.4.4" --deploy production

and then I tried update my app and result is: success ☺

So CLIv3 is the bad guy.

Thank you for your advice.

My package.json: "ionic-plugin-deploy": "^0.6.7",

decpio avatar May 16 '17 08:05 decpio

ionic-plugin-deploy is a Cordova plugin that has to be installed via this command:

`cordova plugin add ionic-plugin-deploy --save'

Did you do this? Can you post the output of cordova plugin list please?

janpio avatar May 16 '17 09:05 janpio

I reinstalled ionic-plugin-deploy, so now I’m sure that I have right version. Then I upgraded CLI to v3 and again I have problem with extraction.

λ cordova plugin list cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1.0.4 "Console" cordova-plugin-inappbrowser 1.7.0 "InAppBrowser" cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)" cordova-plugin-network-information 1.3.0 "Network Information" cordova-plugin-splashscreen 4.0.0 "Splashscreen" cordova-plugin-statusbar 2.2.0 "StatusBar" cordova-plugin-whitelist 1.3.0 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-barcodescanner 6.0.2 "BarcodeScanner" ionic-plugin-deploy 0.6.7 "IonicDeploy" {}

Any ideas?

Thanks

decpio avatar May 16 '17 10:05 decpio

You also built a new app version with the plugin, uploaded a new snapshot to Ionic and then triggered that snapshot to be downloaded?

(Asking explicitly as you didn'T mention these steps)

janpio avatar May 16 '17 10:05 janpio

I wasted a lot of time to install/uninstall/build/upload/check, but I finally found whats going wrong: On device was installed *.apk generated earlier, using CLIv2 and previous version of deploy plugin. And this aplication won’t upgrade from cloud to newest version.

I ran: ionic cordova build android --prod –release and I have file in folder: \platforms\android\build\outputs\apk\android-debug.apk

Why not release?

Then I ran: cordova build android –release

and then I have: \platforms\android\build\outputs\apk\android-release.apk

On device I uninstalled old ver of this app, and installed *.apk generated using CLIv3 and newest deploy plugin.

Then I ran: ionic upload --note "stable # ver 3.4.4" --deploy production

to generate new snapshot, and from now cloud-update will work properly.

Summary: We need to install on every device fresh copy of application using *apk file. I think to be nice to add this info to instruction of ‘how to upgrade to IONIC CLIv3’ Thanks for your help.

decpio avatar May 16 '17 12:05 decpio

On device was installed *.apk generated earlier, using CLIv2 and previous version of deploy plugin. And this aplication won’t upgrade from cloud to newest version.

That makes sense as the native part contains the old, broken version of ionic-plugin-deploy.

We need to install on every device fresh copy of application using *apk file. I think to be nice to add this info to instruction of ‘how to upgrade to IONIC CLIv3’

Is this only caused by the CLI v3 update? Or would it maybe also happen with CLI v2?

janpio avatar May 16 '17 13:05 janpio

Binary changes (such as an update to Cordova plugins) always require a new binary deploy to devices.

I will add a note about needing to upgrade the Deploy plugin for CLI v3.

imhoffd avatar May 16 '17 15:05 imhoffd

With CLI v2 I had no such problems.

decpio avatar May 17 '17 05:05 decpio