Error "The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable program"
Asked Answered
G

25

101

I'm trying to install flutterfire_cli in my root project, so I typed this command:

FirebaseFirestore firestore = FirebaseFirestore.instance;

After that, this is the console session (PowerShell):

cd C:\Users\PC\Desktop\eventually
dart pub global activate flutterfire_cli

Output:

Package flutterfire_cli is currently active at version 0.1.1+2.
Resolving dependencies...
The package flutterfire_cli is already activated at newest available version.
To recompile executables, first run `global deactivate flutterfire_cli`.
Installed executable flutterfire.
Warning: Pub installs executables into C:\Users\PC\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.

To fix the warning, I added C:\Users\PC\AppData\Local\Pub\Cache\bin to my Path environment variable in the system variables environment. (But it does not work, I'm still getting the warning)

Next, I'm trying to generate the firebase_options.dart file as the documentation says using this command:

flutterfire configure

But I'm getting an error in the console (PowerShell):

cd C:\Users\PC\Desktop\eventually
flutterfire configure

Output:

flutterfire : The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ flutterfire configure
+ ~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (flutterfire:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

What am I missing? Why am I getting this error even if the Firebase CLI is already installed on my machine?

Giacometti answered 12/12, 2021 at 1:24 Comment(0)
B
223

Go through this doc very carefully: https://firebase.flutter.dev/docs/cli/

Step 1: Install Firebase CLI

Step 2: Install FlutterFire CLI with this command dart pub global activate flutterfire_cli

While doing this you must notice the following warning

Warning: Pub installs executables into C:\Users\PC\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.

This means you need to add C:\Users\*username*\AppData\Local\Pub\Cache\bin into your System's environment path. It would be better if you restart the computer after adding it to the path variable.

For MacOS run: export PATH="$PATH":"$HOME/.pub-cache/bin"

Step 3: Now flutterfire configure should work.

If still not working play with Firebase commands

Badger answered 12/12, 2021 at 16:9 Comment(4)
For MacOS do: export PATH="$PATH":"$HOME/.pub-cache/bin"Flaxseed
Do not forget to restart your machine after setting the environment variable.Woadwaxen
Thank you, your answer helped me a lot, I was facing the same issueLiederkranz
If anyone from the Dart team ever sees this: please, pretty please, make this warning more visible. It's so easy to miss right now, amid all the output! Why not make "Warning" fully uppercase and change its colour to e.g. orange?Schulman
C
69

For Mac -> Execute this command:

export PATH="$PATH":"$HOME/.pub-cache/bin"

Cacilia answered 6/6, 2022 at 16:16 Comment(0)
H
35

Three 3 steps for getting it work on Windows:

  1. Run this command:

    dart pub global activate flutterfire_cli

  2. Type env into Windows search and open Edit the system environment variables --> Environment variables --> System variables( the one on the bottom of the window) --> Double click on Path --> New and enter this:

    C:\Users\PutHereYourUsername\AppData\Local\Pub\Cache\bin

  3. flutterfire configure command should work now - close and open again command prompt or other terminal. Sometimes there is a problem with other editors and terminals where flutterfire configure still does not work. In that case open Command Prompt and it works there for sure.

Hopefully answered 7/7, 2022 at 11:54 Comment(1)
I also had to restart VSCode for it to work. Closing and reopening the integrated termincal wasn't enough.Bromine
E
22

As for me, I have done everything correctly and the command works if I run in the Windows command prompt, but it fails to work if I type the command inside the VS code terminal.

So I just killed the terminal and opened it again, then it works.

Or, you can try restarting your machine.

Extremadura answered 3/1, 2022 at 1:23 Comment(4)
You're right; killing the terminal and opening a new one fixed it, after I also added "C:\Users\PC\AppData\Local\Pub\Cache\bin" to path. Also, the installation of the official Firebase CLI is required, it can be found at firebase.google.com/docs/cli#install_the_firebase_cliRedheaded
It appears that installing the Firebase CLI binary file does not work, you have to use the npm command which requires node installed. Check out #70411343Redheaded
I had to restart vsCode for it to work, kinda weird but thanks for the tipNovotny
I add the path to the user path, add that path to system path, restarted the git bash, restarted the computer, still didn't work in git bash, when I saw your response i tried it on the CMD and it worked, good enough for me!I just wanna get this over withRandall
C
15

Even after adding C:\Users\PC\AppData\Local\Pub\Cache\bin to the path for me flutterfire would not work from the command line, the reason being that it actually instally a flutterfire.bat file.

So I use flutterfire.bat in the command line as of now and that is working.

Cordula answered 23/12, 2021 at 11:32 Comment(0)
S
12

For Linux/Ubuntu run this command in the terminal,

export PATH="$PATH":"$HOME/.pub-cache/bin"

Which you will also notice in the terminal when you run the command ↓.

dart pub global activate flutterfire_cli

Sammie answered 1/7, 2022 at 0:35 Comment(0)
B
5
  1. Make sure you are your project directory
  2. run this export PATH="$PATH":"$HOME/.pub-cache/bin"

enter image description here

Boadicea answered 10/10, 2022 at 10:18 Comment(0)
K
5

Windows: https://mcmap.net/q/211068/-error-quot-the-term-39-flutterfire-39-is-not-recognized-as-the-name-of-a-cmdlet-function-script-file-or-operable-program-quot

Mac:

  1. Open Terminal and run:

    dart pub global activate flutterfire_cli
    export PATH="$PATH":"$HOME/.pub-cache/bin"
    
  2. Run: flutterfire --version

  3. If you get a version number, flutterfire has been installed successfully

Kurzawa answered 22/2, 2023 at 12:3 Comment(0)
C
2

For Linux/Ubuntu you should do the following:

  1. Open your .bashrc file using the command "sudo nano ~/.bashrc"
  2. Add export PATH="$PATH":"$HOME/.pub-cache/bin" to the end of the file.
  3. Final you can source the file using "source ~/.bashrc"
  4. It should now be able to recognize the file.
Customer answered 13/5, 2022 at 11:52 Comment(0)
H
2
$ flutterfire.bat configure

try this if you are windows user.....

Hersch answered 12/12, 2023 at 13:46 Comment(1)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Vender
B
1

for macOS Monterey edit ~/.zprofile instead .zshrc

Bullyboy answered 31/8, 2022 at 20:36 Comment(0)
S
1

This was the hack i used to solve mine. I copied and pasted the C:\Users\PC\AppData\Local\Pub\Cache\bin in my folder search bar to enter the folder, note I could not find any folder called AppData, but when I pasted it on the folder search it did take me to the bin folder.

In the bin folder, you will find a file called flutterfire.bat. Copy and paste the flutterfire.bat file in the root of your project and then run the .\flutterfire configure command. Please do note the dot (.) and forward-slash (\). You need to add it to work.

Serous answered 2/9, 2022 at 16:37 Comment(1)
The reason why you couldnt findthe "Appdata" folder was because its hidden by default in windows. toggle show hidden files and folders option and you can see themToddtoddie
B
1

for mac m1 , add export PATH="$PATH":"$HOME/.pub-cache/bin" at the top of users/username/.profile , works on (monterey)

Bowne answered 27/9, 2022 at 15:53 Comment(0)
W
1

For me, even after I installed everything correctly, restarting my IDE(VSCode) did the trick.

Waiwaif answered 13/10, 2022 at 15:38 Comment(0)
A
1

For Ubuntu add followong to your bashrc file

export PATH="$PATH":"$HOME/.pub-cache/bin"

Steps:

  1. nano ~/.bashrc

  2. paste export PATH="$PATH":"$HOME/.pub-cache/bin" to bottom of file

  3. ctrl^O then enter then ctrl^X

  4. Restart your IDE

Appreciation answered 24/3, 2024 at 8:16 Comment(0)
B
0

Flutter command not found Here is very easy instructions for adding something to your path on Mac, It solved my issues with Flutter and Flutterfire.

Binetta answered 2/5, 2022 at 8:44 Comment(0)
P
0

The export PATH="$PATH":"$HOME/.pub-cache/bin" did not work on my Debian machine!

I removed the first line #!/usr/bin/env sh from $HOME/.pub-cache/bin/flutterfire file and the flutterfire command worked properly.

Pappy answered 6/2, 2023 at 9:15 Comment(0)
A
0

it will not work in GitBash or vsCode terminal , you have to open windows cmd and run it .(after settng up path as already mentioned above)

Aldenalder answered 23/7, 2023 at 6:28 Comment(0)
D
0

I have had this issue in windows for several hours and I want to share my solution. I downloaded the standalone binary and put it in the parent of my root folder. I then duplicated the .exe and renamed it to firebase.exe and moved it into my flutter project folder. In VSCode I activated the firebase-tools-instant-win.exe to use as my shell (firebase login etc...) In the shell you cd flutter_project\ and then you can run your dart pub global activate flutterfire_cli and flutterfire configure.

Final Structure Outline

  • Repository
    • flutter_project
      • flutter files
      • firebase.exe (duplicated exe)
    • flutter_project_2
    • flutter_project_3
    • firebase-tools-instant-win.exe (use this shell)

I also have added C:\Users\<user>\AppData\Local\Pub\Cache\bin to system env variable: PATH Hope this helps someone... This was a very frustrating problem to solve.

Differentiate answered 29/8, 2023 at 12:54 Comment(0)
S
0

After executing the 'flutterfire configure' command in Firebase CLI. Got the below error as

⠏ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
Error: C:\Users\VSS00\CACHE~1\firebase\runtime\node....

#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3      _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4      JsonDecoder.convert (dart:convert/json.dart:610:36)
#5      runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
<asynchronous suspension>
#6      getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
<asynchronous suspension>
#7      ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:300:24)
<asynchronous suspension>
#8      ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:390:37)
<asynchronous suspension>
#9      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#10     main 

Solution

  • Ensure you have logged into the Firebase CLI with the valid account and created a project in the Firebase console
  • Close the Android Studio (or) VS Code
  • open the file 'node.bat' from C:\Users\PC.cache\firebase\runtime (it will open an another Firebase CLI terminal)
  • navigate to the Flutter project directory in the terminal (like E:/projects/myflutterapp)
  • Run the command : flutterfire configure

It will list out the project and you can move forward.

Selfeducated answered 16/11, 2023 at 15:42 Comment(0)
M
0

sudo flutterfire configure this work for me

Mechanist answered 2/12, 2023 at 18:41 Comment(0)
G
0

For me, it didn't work because I initially attempted to call it from outside the project directory. When I copied the absolute path to my project and navigated to it with 'cd path', it finally worked.

Ger answered 29/3, 2024 at 15:45 Comment(0)
A
0

For windows, Don't be afraid very simple.

Just follow Elmar's answer or read the warning carefully. It already says what you have to do.

  1. Add the path(given by the warning) to your system variable(not on the user).
  2. Restart your vscode if you're still unable to configure.
Angioma answered 21/4, 2024 at 0:18 Comment(0)
B
-4

Use command prompt.. not the vsc terminal

Beutler answered 4/2, 2022 at 3:16 Comment(0)
A
-4

if you followed the right answer and still not working, you need to restart your computer

Anselma answered 7/5, 2022 at 9:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.