2
votes

I am trying to add firebase to an angular 6 project.

npm install firebase angularfire2 --save

This project is based on ngx-admin, with some modification. I am a noob coming to angular and typescript.

After running the above-mentioned command, trying ng serve gives me

ERROR in node_modules/angularfire2/auth/auth.d.ts(4,10): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'User'. node_modules/angularfire2/auth/auth.d.ts(4,16): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'auth'. node_modules/angularfire2/firebase.app.module.d.ts(2,10): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'app'. node_modules/angularfire2/firebase.app.module.d.ts(2,15): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'auth'. node_modules/angularfire2/firebase.app.module.d.ts(2,21): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'database'. node_modules/angularfire2/firebase.app.module.d.ts(2,31): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'firestore'. node_modules/angularfire2/firebase.app.module.d.ts(2,42): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'functions'. node_modules/angularfire2/firebase.app.module.d.ts(2,53): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'messaging'. node_modules/angularfire2/firebase.app.module.d.ts(2,64): error TS2305: Module '"/Users/arash/Src/dance-admin/node_modules/firebase/app/index"' has no exported member 'storage'.

```

I am very puzzled here, as the errors are coming from inside angularfire2, and not my project. What is more puzzling is that, if I do the same thing with a brand new ng application, it just work fine.

So I guess the real question is, what these error messages mean? As the imports in the angularfire2 is clearly correct - at least at some setups.

2

2 Answers

2
votes

It seems that the last update broke something. There is listed a breaking change here. Until a solution has been posted, you can use an older version of angularfire2. The release candidate 9 seems to work fine. Simply edit your package.json and replace the line

"angularfire2": "^5.0.0-rc.10" // Gets the newest version

with

"angularfire2": "5.0.0-rc.9" // Gets a specific version
1
votes

This worked for me. made sure the versions in package.json were:

angularfire2": "5.0.0-rc.9",
"firebase": "5.0.2",