15
votes

I have been working on angular and i wanted to use firebase for back end. I install angular fire following this instruction https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md here is my package.json

"angularfire2": "^5.0.0-rc.4",
"firebase": "^4.8.1",

I am facing this problem. Can anyone help me with this?

ERROR in node_modules/@firebase/database/dist/esm/src/api/Database.d.ts(4,33): error TS2307: Cannot find module '@firebase/app-types/private'.  node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts(17,39): error TS2307: Cannot find module '@firebase/app-types/private'.
4

4 Answers

37
votes

Change your firebase version back to 4.8.0. There was an issue in type definitions and its no longer work after updating from 4.8.0 to 4.8.1.

So change the version in the package.json file. remove the ^

"angularfire2": "^5.0.0-rc.4",
"firebase": "4.8.0",

Now execute the npm install command. This will install the 4.8.0 version

For further info refer this and this.

13
votes

There's a problem with the newest npm firebase package (v4.8.1).

To fix this problem, in your terminal. Type

npm uninstall --save firebase

Now, open your package.json file. There, you will find:

"angularfire2": "^5.0.0-rc.4",

Below this line, add a this line (Note, here is no Caret(^) symbol):

"firebase": "4.8.0",

After saving, hit npm install. Now, your application will work fine and smooth.

0
votes

if problem persists , my shortcut is that just open providers/firebase/firebase.ts , just copy all content and paste it again on it.. it will work fine with firebase database if no error on other program.

if anyone know permanent solution for this... share it..

0
votes

To anyone else who came to this question from Google or elsewhere, AngularFire2 RC.6 has been released with full support for the latest firebase SDK. At the time of writing this the Firebase JavaScript SDK is at v4.8.2, or v4.9.0. The solution provided in this question was correct for that time. If this question were to be asked today, the answer should be to upgrade Angularfire2 to the latest along with Firebase v4.8.1 or higher.

If your build runs without any problems, then you are probably on Windows. I am finding that I am not able to build on a Mac or Linux machine ATM. I will be posting a question about that shortly.

Hope this helps somebody!