Angularfire: Cannot find module '@firebase/app-types/private'.

Created on 31 Dec 2017  Â·  9Comments  Â·  Source: angular/angularfire

Hi guys, I am working on Ionic2 project with firebase

I tried this

Inside package.json, remove ^ from "firebase": "^4.8.1"
1.1 Downgrade Firebase from 4.8.1 to 4.8.0 by changing 4.8.1 to 4.8.0
1.2 End result should look like this: "firebase": "4.8.0"
Run npm update in the Project Root. NPM will downgrade Firebase for ya
Run ionic serve to check for compilation errors

But unable to resolve the following issue in ionic2

typescript: Users/vyas/node_modules/@firebase/database/dist/esm/src/api/Database.d.ts, line: 4
Cannot find module '@firebase/app-types/private'.

L3: import { FirebaseApp } from '@firebase/app-types';
L4: import { FirebaseService } from '@firebase/app-types/private';
[08:59:27] typescript: ...rs/vyas/node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts, line: 17
Cannot find module '@firebase/app-types/private'.

L16: getToken(forceRefresh: boolean): Promise;
L17: addTokenChangeListener(listener: (token: string | null) => void): void;
L18: removeTokenChangeListener(listener: (token: string | null) => void): void;

Can any body help me with this.

Most helpful comment

SOLVED

  1. Open package.json and update firebase version to 4.8.0
"firebase": "4.8.0"
  1. Run npm install

That's it!

All 9 comments

Hey @vyasm9! We have this fixed in master but we haven't released yet. Make sure to keep your Firebase version at 4.8.0 or below.

hey @vyasm9 iam suffering with the same problem .
do u have any solution for that

Yes it will solve the issue.

On Jan 6, 2018 12:48 PM, "RamkumariAmbati" notifications@github.com wrote:

hey @vyasm9 https://github.com/vyasm9 iam suffering with the same
problem .
do u have any solution for that

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angularfire2/issues/1398#issuecomment-355733305,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADP1xzwcO6s8rf7dBt8Y4xsEcCE0Ch60ks5tHzN0gaJpZM4RPxmX
.

SOLVED

  1. Open package.json and update firebase version to 4.8.0
"firebase": "4.8.0"
  1. Run npm install

That's it!

If we do like that the issue is not fixed in ionic project.

On Jan 6, 2018 4:59 PM, "Renjith VK" notifications@github.com wrote:

SOLVED

  1. Open package.json and update firebase version to 4.8.0

"firebase": "4.8.0"

  1. Run npm install

That's it!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angularfire2/issues/1398#issuecomment-355745423,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADP1x95uEZp1M3L_dE6U5THfHT7Gf3NSks5tH24YgaJpZM4RPxmX
.

tq @vyasm9 and @renjithvk

@vyasm9 I got it fixed in my ionic project. I'd used firebase library directly in ionic without do install angularfire2 or ionic native firebase plugin.

@vyasm9 Then, how can we solve the issue in ionic project?
@renjithvk How can I use firebase library directly? Can you explain in detail for me?

@YoungsooJang You can use firebase with ionic same as how you use it in other JavaScript projects
Official doc: https://firebase.google.com/docs/web/setup

  1. Install firebase
$ npm install firebase --save
  1. Import it into your app component (app.component.ts)
import * as firebase from "firebase"
  1. Initialise it in app component constructor
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
  apiKey: "<API_KEY>",
  authDomain: "<PROJECT_ID>.firebaseapp.com",
  databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
  storageBucket: "<BUCKET>.appspot.com",
};
firebase.initializeApp(config);
  1. Import firebase on your page component
import * as firebase from "firebase"
  1. Use the firebase services on your component methods
firebase.auth()
firebase.storage()
firebase.database()
firebase.firestore()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephenFluin picture StephenFluin  Â·  3Comments

jteplitz picture jteplitz  Â·  3Comments

DennisSmolek picture DennisSmolek  Â·  3Comments

Maistho picture Maistho  Â·  3Comments

martinyoussef picture martinyoussef  Â·  3Comments