Resolving firebase type definitions error when developing Ionic mobile applications

January 4, 2018, 9:54 pm Categories:

Categories

There's nothing more frustrating than wanting to get stuck into some coding only to be greeted by software bugs and errors - particularly when you've got deadlines to meet and various tasks yet to be tackled.

This situation was brought home to me recently after I ran into the following error when trying to launch an ionic/firebase project in the web browser with ionic serve:

Cannot find module '@firebase/app-types/private'

Definitely not the result I was expecting!

Unfortunately this appears to be a problem relating to the type definitions being refactored for v.4.8.1 of the npm firebase package.

Fortunately it's easy to resolve!

Fixing the issue

The solution?

Simply uninstall the current version of the firebase npm package and install/downgrade to the previous version instead.

From your command line, and ensuring that you are within the project directory that is affected by this error, run the following command to uninstall the firebase npm package (which will also remove the package listing from the project's package.json file):

npm uninstall --save firebase

Once completed open the project's package.json file and enter the previous version of the firebase npm package within the dependencies section, above the ionic-angular dependency listing, like so:

"firebase": "4.8.0",
"ionic-angular": "3.9.2",

Now return back to your CLI and run the following command to install this downgraded version of the firebase npm package:

npm install

With the previous version of the npm firebase package now installed the type definitions error is fixed.

Simple as!

In summary

Software bugs are frustrating to deal with and I've yet to meet a developer who actually enjoys having to find solutions/workarounds to their presence in a project.

Fortunately the above software bug is easily fixed by downgrading to the previous version of the npm firebase package.

If you've enjoyed what you've read and/or found this helpful please feel free to share your comments, thoughts and suggestions in the comments area below.

I explore different bugs that I've encountered, and their solutions, when working with the Ionic framework in my e-book featured below and if you're interested in learning more about further articles and e-books that I'm writing then please sign up to my FREE mailing list.

Tags

Categories

Post a comment

All comments are welcome and the rules are simple - be nice and do NOT engage in trolling, spamming, abusiveness or illegal behaviour. If you fail to observe these rules you will be permanently banned from being able to comment.

Top