I tried on integrating Firebase into the project for the first time but I am unable to run it in my Flutter App.
I have tried installing Firebase into my system. I downloaded Firebase CLI from the website and also added following dependencies:
firebase_core: ^3.2.0
firebase_auth: ^5.1.2
cloud_firestore: ^5.1.0
firebase_storage: ^12.1.1
dash_chat_2: ^0.0.21
firebase_analytics: ^11.2.0
I have already added this to path address in environment variable settings, but when I run flutterfire configure
as shown in youtube videos, I get following error:
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase –version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
And when I run on Command Prompt, this shows:
D:FLUTTER PROJECTSriverpod_course>flutterfire configure
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase –version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
2
Answers
Complete the installation using the
npm install -g firebase-tools
command and then you can install the CLI using thedart pub global activate flutterfire_cli
command.Note : Make sure you have nodejs/npm installed on your computer before using the
npm install -g firebase-tools
command.I encountered the same issue. Here’s an alternative method for adding Firebase to your project using Fast Node Manager instead of the Firebase CLI binary:
Installing Fast Node Manager
First, install Fast Node Manager using PowerShell:
Adding Firebase
Next, add Firebase to your project:
Finally, ensure Firebase is initialized in your app by calling:
await Firebase.initializeApp();
on your app.