ionic2blueprints/firebase-chat

Cannot find namespace firebase

RichLinnell opened this issue · 5 comments

I have followed the first example in the book exactly, but I am getting a lot of errors. I fixed a few of them, the frameworks had clearly changed their interfaces (the utils class for example), but I am now stuck. I cannot get the typescript to compile and I am receiving a lot of "Cannot find namespace firebase" errors.

I have searched the internet and there seems to be a lot of people encountering similar issues with Ionic2, or just plain old Angular2 and Firebase. I am guessing that I am just too early and these guys haven't all got their acts together yet, and if I come back in 6 months then it'll all be plain(er) sailing. However, this kind of renders the book obsolete for me which is a bit of a shame as I like the writing style.

I have looked at the code on here and your typings globals folder seems to have a firebase3 folder in it, mine doesn't.

It may be that their is a simple fix to this and I am just missing something, which would be a far better outcome. Any pointers, greatly appreciated.

My entered code is on my github public site here

Hi @RichLinnell Thanks for reporting this. I am already aware of this problem. Ionic2's API won't change now.

I have mentioned in the preface that, Ionic and other libraries would change because they are in beta. So, it was inevitable that they will make book obsolete. So, already mentioned that, we will update the book. You will get latest version in your Packt Account.

Quickest solution:

  • copy package.json file of this repo and put that into your app.
  • remove the already present node_modules folder
  • npm install
  • follow the book.

Leaving this issue opened for other readers.

Brilliant, I'll give it a spin when I get home.

As a side note, I am reading the book on SafariBooksOnline (O'reilly site), will this also be updated do you know?

Thanks once again for your very speedy response.

As instructed, I copied the package.json, deleted the node_modules, and ran npm install, but unfortunately I am still getting the same error.

I have pushed the updated code base up to my GitHub repo.

I checked your repo. You have misconfiguration in typings.json. (Not your fault, due to change in Firebase and Angularfire2) Remove any reference to firebase in this file and Remove Firebase Files from typings folder too. then go to 265 page follow from Installing Typescript definitions for Firebase section. It will work, as I checked it on my end.

Thanks for all your help, it worked like a dream in the end, I now have it running on my iPhone and on my iMac with a chat session going between the two devices. I can also see all the messages being persisted in the Firebase DB too.

I still have a few issues, most intriguingly is that the intellisense in SublimeText is giving me errors pertaining to things that I know have changed in the latest version of Ionic, i.e. the way Alerts are handled, but the code is actually running. I assume this will be because I have typings for the latest Ionic2 release, but the package.json we took from here is pointing to an older version?