skip to Main Content

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


  1. Complete the installation using the npm install -g firebase-tools command and then you can install the CLI using the dart 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.

    Login or Signup to reply.
  2. 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:

    # installs fnm (Fast Node Manager)
    winget install Schniz.fnm
    
    # create required environment
    fnm env --use-on-cd | Out-String | Invoke-Expression
    
    # download and install Node.js
    fnm use --install-if-missing 20
    
    # verifies the right Node.js version is in the environment
    node -v # should print `v20.15.1`
    
    # verifies the right NPM version is in the environment
    npm -v # should print `10.7.0`
    

    Adding Firebase

    Next, add Firebase to your project:

    # install firebase tools
    npm install -g firebase-tools
    
    # login to firebase account you want to connect to your project
    firebase login
    
    # activate flutterfure cli
    dart pub global activate flutterfire_cli
    
    # Navigate to your project directory and run the following command to config your project
    flutterfire configure
    

    Finally, ensure Firebase is initialized in your app by calling: await Firebase.initializeApp(); on your app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search