Ionic push: web client incorrectly installs

Following the guidelines here: http://docs.ionic.io/docs/push-from-scratch I am having trouble with step 2 - installing ionic add ionic-platform-web-client.

My index file within my app adds <script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js"></script> as it should, however the file doesn’t exist at this location, even after running ‘ionic lib update’.

(For ease of explanation in this section I am using the non minified version of the bundle: ionic.io.bundle.js (the results are the same with both full and minified versions of the files)).

Manually adding ionic.io.bundle.js from https://github.com/driftyco/ionic-platform-web-client/tree/master/dist will give me this error:

"Uncaught TypeError: Cannot call method ‘get’ of undefined

ionic.io.bundle.js (3429,0)"

from this code:

key: "get", value: function get(name) { return this._settings.get(name); }

I found a ‘hacky’ way to get the dev pushes working by simply returning this instead of the full return this._settings.get(name) statement, although this only really suits the purpose of debugging and additionally does not allow removal of developer mode by settings ‘ionic config set dev_push false’ or manually setting "dev_push":false in .io-config.json.

I am unsure as to whether manually adding ionic.io.bundle.js is simply adding to my problems or whether this is the right approach to take and that the errors produced are the real problem?

I am running:
ionic 1.1.0
ionic CLI 1.7.7,
cordova 5.3.3,
bower 1.6.2,
npm 2.11.3,
visual studio 2015 community with cordova/ionic setup, I’ve also updated my android platform - for which I am currently building to (deploying to nexus 7).

Some problem here.
ionic.io.bundle.min.js is missing in lib folder

I have exactly the same problem. When I was following the tutorial I installed ionic platform web client and because I had a customized file structure on the beginning it didn’t worked (I got the error ERROR: { [Error: ENOENT, open './www/js/app.js'] errno: -2, code: 'ENOENT', path: './www/js/app.js' } Is your app declaration contained in 'app.js'? and also the error that ionic.io.bundle.min.js is missing.

So I removed the platform, rearranged my file structure so that the app.js is on it’s original location and reinstalled the web client platform. The error ERROR: { [Error: ENOENT, open './www/js/app.js'] errno: -2, code: 'ENOENT', path: './www/js/app.js' } Is your app declaration contained in 'app.js'? dissapeared, but the missing ionic.bundle error was still present.

I manually edited the line that was automatically added on the install, from

<script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js"></script>

to <script src="assets/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js"></script>.

Ionic seems to recognize the file now and load it, however now I got the error “Cannot read property ‘get’ of undefined” on line 2.

Help please!

1 Like

Same problem, is ionic team working on this?
Did some tests, updated ionic cli (npm install -g ionic) since i had a previous version.
installed and configured a new application from scratch and it seems to find missing files.
When doing the same with an existing app error still there.

Although I still haven’t been able to install the ionic web platform via ‘ionic add ionic-platform-web-client’ in the cli I have managed to get the ionic push notifications working.

  1. Firstly I made sure in my app directory within the cli to use ‘ionic lib update’. As the setup of my project was different (thanks to visual studio). You will likely already have these files using a custom setup, but I found it’s good to have the directories in place.

  2. Secondly I manually downloaded the web client https://github.com/driftyco/ionic-platform-web-client not just the ionic.io.bundle.min.js which seemed to fix my “Uncaught TypeError: Cannot call method ‘get’ of undefined” problem mentioned previously, after I moved the entirety of this in my lib directory. (Make sure the name of the downloaded folder matches: “ionic-platform-web-client” exactly, and doesn’t contain any words like master).

  3. Thirdly, as I couldn’t add version 1.3.0 of the push plugin (which continually gave me the beloved ‘uh oh’ error) I used 1.2.3 instead. I installed this via: ‘cordova plugin add https://github.com/phonegap/phonegap-plugin-push.git#1.2.3’. Although I have just noticed 1.4.0 is available which may also work?

This should hopefully fix any issues you have, even if it’s not a perfect solution. As a side note: I know it is mentioned somewhere on one of the ionic pages that you need to have a traditional project setup and then move the relevant files but it would be nice to have some description of how to go about this - as you may not know what the relevant files are. For anyone who comes here scratching their heads, If you’re using visual studio to create your ionic projects from scratch or any other custom setup, you will likely run into the same issues, as the relevant directories created using ‘ionic start myApp’ will likely have been omitted.

1 Like