I'm trying to access something from Firestore and I got this error
ERROR Error: Make sure 'firestore' is enabled in 'firebase.nativescript.json', then clean the node_modules and platforms folders
Here is my firebase.nativescript.json file
{
"using_ios": true,
"using_android": true,
"analytics": false,
"firestore": true,
"realtimedb": true,
"authentication": false,
"remote_config": true,
"performance_monitoring": true,
"external_push_client_only": true,
"messaging": true,
"in_app_messaging": true,
"crashlytics": true,
"storage": true,
"functions": true,
"facebook_auth": false,
"google_auth": false,
"admob": false,
"dynamic_links": false,
"ml_kit": false
}
As it is clearly mentioned in configuration file that firestore : true It should not show this error and get data from Firestore
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ns-homepage',
templateUrl: './homepage.component.html',
styleUrls: ['./homepage.component.css']
})
export class HomepageComponent implements OnInit {
dt = "";
firebase = require('nativescript-plugin-firebase/app');
constructor() {
this.firebase.initializeApp()
.then(() => console.log(`working as expected%%%%%%%%%%%%%`))
.catch((err) => console.log(`%%%%%%%%%%%% ${err}`))
}
ngOnInit() {
}
onSubmit(event) {
this.dt = event;
}
Firebase() {
this.firebase.firestore().collection('Users').get().then(d => {
this.dt = d;
}).catch((er) => {
this.dt = er;
})
}
}
What's the command used to run this app? If it's not using the preview command (which you shouldn't) then make sure to remove the platforms and node_modules folders. Then run again.
Well I was trying to use tns preview command actually. Do I need build ?
Yeah, the Preview wrapper app doesn't come with the Firebase plugin installed so you can't use it.
Most helpful comment
What's the command used to run this app? If it's not using the
previewcommand (which you shouldn't) then make sure to remove the platforms and node_modules folders. Then run again.