Ionic Deploy - cordova.js not found after update

I’m trying implementing Ionic Deploy with ionic v1 (v1.3.1), but when the app loads a downloaded and extracted update, the app crashes. Debugging remotely the app, I see that, after the update, the console shows this error:

GET file:///data/user/0/com.example.www/app_12b7t876-f543-098j-b65f-6h9u098jh123/cordova.js net::ERR_FILE_NOT_FOUND

Using an absolute url to referencing the cordova.js file I was able to see it working on Android, but I think that this is not the right way, specially because on iOS the url is different:

  <!-- <script src="cordova.js"></script> -->
  <script src="file:///android_asset/www/cordova.js"></script>

How I need to reference the cordova.js file?

I tried commenting out the cordova.js (or removing it) from index.html, but didn’t work also.

Maybe I missing something more?

Thanks!

Hoping that will help someone, here’s my full implementation:

config.js

    $ionicCloudProvider.init({
      core: {
        app_id: 'myappid',
        api_key: 'myapikey' // ApiKey is mandatory for ionic deploy??
      },
      insights: {
        enabled: false
      }
    });

run.js

      $ionicDeploy.channel = 'dev';

      $ionicDeploy.check().then(function(snapshotAvailable) {
        if (snapshotAvailable) {
          $ionicDeploy.download().then(function(res) {
            return $ionicDeploy.extract();
          }).then(function(res) {
            return $ionicDeploy.load();
          });
        }
      });

Ionic Info:

global packages:

    @ionic/cli-utils : 1.4.0
    Gulp CLI         : CLI version 1.2.2 Local version 3.9.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/cli-plugin-gulp   : 1.0.1
    @ionic/cli-plugin-ionic1 : 2.0.0
    Ionic Framework          : unknown

System:

    Node       : v6.9.1
    OS         : Linux 4.4
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 4.5.0 

Installed platforms:

  android 5.1.1

Cordova plugins:

ionic-plugin-deploy 0.6.7 "IonicDeploy"

Can you put a proxy between you and the Deploy to get a copy of the .zip and look inside?

Thank you for your answer @Sujan12! Sincerely I don’t know how to add the proxy. There is a quick way to do this?

I looked the zip (www.zip) sent to the ionic cloud using the command “ionic upload” and it was fine. I send a zip, with the index.html with:

<script src="cordova.js"></script>

but the plugin “ionic-plugin-deploy” when load the downloaded update, change the url to:

<script src="file:///data/user/0/com.example.www/app_12b7t876-f543-098j-b65f-6h9u098jh123/cordova.js"></script>

This url doesn’t not exist.

So the problem seems to be related only to the cordova.js url.
Googling a bit, I saw that, with an older version of the Ionic Deploy, was required comment out the cordova.js from the index.html. But with the current version there’s not info on the documentation about this. I also tried to comment it out, but doesn’t worked.

Download Charles Web Proxy for example.

But the folder exists?

The folder should be the extracted new version of the app. That’s why I want you to look at the .zip and see if there is a cordova.js in there at all.

I solved the problem. The problem was due to my custom gulp build script, that was minifying the index.html removing attribute quotes and collapsing white spaces:

<script src=cordova.js></script>

Without the quotes, the plugin, change the url putting a wrong one. I tested it only on android.

1 Like