'flutterfire configure' command not working, I need to set firebase in my flutter project

Viewed 6252

I followed "https://firebase.flutter.dev/docs/overview" instruction to set firebase in my flutter project.

step i took:

  1. "flutter pub add firebase_core" then dependencies were added, and generated_plugin_registrant.dart was created. generated_plugin_registrant.dart file

2) "dart pub global activate flutterfire_cli" it showed an warnign message ie "Warning: Pub installs executables into C:\Users\Asus\AppData\Local\Pub\Cache\bin, which is not on your path. You can fix that by adding that directory to your system's "Path" environment variable. A web search for "configure windows path" will show you how. Activated flutterfire_cli 0.1.1+2."

  1. then i added "C:\Users\Asus\AppData\Local\Pub\Cache\bin" in system; "path" environment variable.

  2. "flutterfire configure" now it gives error "bash: flutterfire: command not found".

8 Answers

Step by step commands for getting flutterfire work in Mac:

dart pub global activate flutterfire_cli  
export PATH="$PATH":"$HOME/.pub-cache/bin"
curl -sL https://firebase.tools | bash  
firebase login
flutterfire configure

More details here

I had the same problem. Following command worked for me.

flutterfire.bat configure

Windows Step-by-Step guide:

  1. Open the Windows Search Bar, type in “env”, and choose “Edit the system environment variables”

  2. Click the “Environment Variables…”

  3. In System Variables box, search for "PATH" and double click on it

  4. Click "New" and then paste the following line, replacing *USERNAME* with your Windows username

    C:\Users\*USERNAME*\AppData\Local\Pub\Cache\bin

  5. Click Ok and restart your IDE, then try flutterfire commands

I had same problem and I solved this by:

  1. Added C:\Users\<username>\AppData\Local\Pub\Cache\bin to Environment Path.
  2. Restarted IDE
  3. Executed command: dart pub global activate flutterfire_cli

Here's a solution that worked for me:

  1. From your terminal,open your bash profile in your home directory. Example home directory, Users/your-name/. I'm using macOS, so I typed typed the command sudo vim ~/.bash_profile from my home directory folder, followed by E to edit.

  2. Scroll to the bottom of the file or below # Flutter ENV, on your keyboard, hit i to insert, then paste the following line, export PATH="$PATH":"$HOME/.pub-cache/bin". Press ESC, type ":wq!" then press Enter to save the changes and exit vim.

  3. From the command line, reload your bash profile with source ~/.bash_profile. flutterfire configure should now work.

Hrishabh This worked for me.

Close your IDE. Restart IDE. Re-run "flutter pub add firebase_core" in your terminal. Finally run "dart pub global acttivate flutterfire_cli" in your terminal.

I had the same problem here is the way to solve it:

Warning: Pub installs executables into C:\Users\userName\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
  1. Go the Windows searchbar and write var

  2. Select modify system environment

  3. Click on environment variables

  4. On system variables click on Path

  5. Click on Edit

  6. On the modify the environment variable windows click on New

  7. Copy paste C:\Users\userName\AppData\Local\Pub\Cache\bin

  8. Close all the windows clicking on Ok

  9. Restart Android Studio

  10. Inside Android Studio terminal write this to check if succeed

    dart pub global activate flutterfire_cli

You should have the following message:

The package flutterfire_cli is already activated at newest available version.

On windows, from flutter root folder, running 'flutterfire configure' I got the same error message.

The 'problem' was resolved when I removed the following lines from pubspec.yaml.

  plugin:
    platforms:
      ios:
        pluginClass: AppDelegate

(I added those lines in an attempt to create a "podfile" that is required in order to create a binary ios file. )

Related