Uncaught Error: Cannot find module "@firebase/auth"

This is related to Firebase on ionic.

Am hitting upon a "Uncaught Error: Cannot find module “@firebase/auth”"
Tried all the options listed on different threads I searched

Looks like a stack changed code push from Firebase caused it , as the same code was working fine until I tweaked a small change.

I tried the following

npm uninstall firebase
npm cache clear --force
npm install firebase@4.8.0

Even tried
npm install firebase --latest

Nothing works
I tried 4.8.2 , even that does not work.

Any input on how to fix this would be much appreciated.

I had a similar problem - this worked for me but I not sure but try the following:

1- go into node_modules folder
delete folders: @firebase and firebase

2 - run npm install firebase@4.8.0

Thanks for your input.
Tried that , but the problem still persists

Blockquote
Uncaught Error: Cannot find module “@firebase/auth”

Blockquote

webpackMissingModule@http://localhost:8100/build/vendor.js:116964:74
http://localhost:8100/build/vendor.js:116964:156
webpack_require@http://localhost:8100/build/vendor.js:55:34
http://localhost:8100/build/vendor.js:114340:20
webpack_require@http://localhost:8100/build/vendor.js:55:34
http://localhost:8100/build/main.js:144:86
webpack_require@http://localhost:8100/build/vendor.js:55:34
http://localhost:8100/build/main.js:258:96
webpack_require@http://localhost:8100/build/vendor.js:55:34
http://localhost:8100/build/main.js:239:89

Are you using AngularFire2?

Yes I am using AngularFire2
tried the following
npm install firebase angularfire2 --save

Did not solve the issue.
It originates from the stack and does not point to any particular line in my code.
It seems to point to this line in an index.js

require(’@firebase/auth’);

//////////////////
// WEBPACK FOOTER
// ./node_modules/firebase/auth/index.js
// module id = 296
// module chunks = 2

I was working on this yesterday and removed AngularFire2 and updated to latest version of firebase 4.9.0.

I followed: https://javebratt.com/ - he has a pdf book with instructions plus examples in github - I give it 9/10 only because it does not include logins for facebook and google (but he does have examples in his blog). If you just want to copy the code you get login, signup and reset password all done for you.

He posted here a few days ago, saying it’s best to use the Cordova plugins for that, because Firebase uses the wrong protocol if you’re web programming on a device. I haven’t tried it yet myself, but it’s on my list.

Yes I was looking at that I just wondered if the Cordova plugins would work on a standalone web version?

Here’s my possibly-wrong plan. Get an authentication token for Google Plus from a plugin, and use it to log in manually.

I was going to add social logins this morning - I well tell you how I get on.

1 Like