I've installed and used AngularFire2 a lot of times for projects, but since the release of v5, I can't set it up correctly.
These are the steps I follow to reach the issue.
$ ionic start angularfire2test tabs
$ npm install angularfire2 firebase --save
package.json
"angularfire2": "^5.0.0-rc.3",
"firebase": "^4.5.2",
Add Firebase credentials to app.module.ts + import default module and database module. This is the most important part
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
...
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(firebaseCredentials),
AngularFireDatabaseModule
],
bootstrap: [IonicApp],
entryComponents: [
....
When I execute $ ionic serve
, I get the error message "Cannot find module "@firebase/database" at webpackMissingModule (http://localhost:8100/build/vendor.js:119190:82)
When checking the node_modules folder, @firebase doesn't have a database subfolder, but the firebase-folder does have a database-folder.
Did I do something wrong or is it a general issue with AngularFire2?
I think it has to do with an issue with npm. When using yarn to install the modules, everything works flawlessly.
yarn add angularfire2 firebase
tldr: Node: 8.4.0/npm: 5.2.0 has issues, yarn works