Skip to content

Resolving 'flutterfire' Command Not Recognized Error

This comprehensive guide addresses the common "flutterfire: command not recognized" error that occurs when trying to configure Firebase for Flutter projects on Windows, macOS, and Linux systems.

Problem Overview

When attempting to use the flutterfire configure command after installing the FlutterFire CLI, users often encounter the error:

flutterfire: The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable program.

This occurs because the FlutterFire CLI installation directory isn't properly added to your system's PATH environment variable, preventing your terminal from locating the flutterfire executable.

Primary Solution: Add Pub Cache to PATH

The most common solution across all operating systems is to add the Dart Pub cache directory to your system's PATH environment variable.

Windows

  1. Activate FlutterFire CLI:

    bash
    dart pub global activate flutterfire_cli
  2. Add to System PATH:

    • Press Windows key + R, type sysdm.cpl, and press Enter
    • Click "Environment Variables"
    • Under "System variables", find and select "Path", then click "Edit"
    • Click "New" and add: C:\Users\YOUR_USERNAME\AppData\Local\Pub\Cache\bin
    • Replace YOUR_USERNAME with your actual Windows username
  3. Restart your terminal or IDE (required for changes to take effect)

macOS/Linux

  1. Activate FlutterFire CLI:

    bash
    dart pub global activate flutterfire_cli
  2. Add to PATH:

    bash
    export PATH="$PATH":"$HOME/.pub-cache/bin"
  3. Make the change permanent:

    • For bash users: Add the export command to ~/.bashrc
    • For zsh users: Add the export command to ~/.zshrc
    • Run source ~/.bashrc or source ~/.zshrc to apply changes

Alternative Solutions

If the primary solution doesn't resolve the issue, try these additional approaches:

1. Restart Terminal/IDE

Sometimes simply restarting your terminal or development environment (VS Code, Android Studio) resolves PATH recognition issues.

2. Use Command Prompt on Windows

If using Git Bash or VS Code terminal, try running the command in Windows Command Prompt instead.

3. Reactivate FlutterFire CLI

Deactivate and reactivate the package to ensure a clean installation:

bash
dart pub global deactivate flutterfire_cli
dart pub global activate flutterfire_cli

4. Use flutterfire.bat on Windows

Instead of flutterfire, try using the batch file directly:

bash
flutterfire.bat configure

Or navigate to the binary location and run it from there:

bash
cd C:\Users\YOUR_USERNAME\AppData\Local\Pub\Cache\bin
.\flutterfire.bat configure

5. System Restart

After modifying environment variables, a full system restart may be necessary for changes to take effect system-wide.

6. Verify Firebase CLI Installation

Ensure you've installed the Firebase CLI separately from the FlutterFire CLI:

bash
# For npm users
npm install -g firebase-tools

# Or download the standalone binary from:
# https://github.com/firebase/firebase-tools/releases

Platform-Specific Instructions

bash
# Add to ~/.zshrc or ~/.bashrc
echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> ~/.zshrc
source ~/.zshrc
bash
# Add to ~/.bashrc
echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> ~/.bashrc
source ~/.bashrc
bash
# Temporary solution for current session
$env:Path += ";C:\Users\$env:USERNAME\AppData\Local\Pub\Cache\bin"

Troubleshooting Common Issues

WARNING

If you encounter JSON parsing errors when running flutterfire configure, ensure you're logged into Firebase CLI with a valid account and have created a project in the Firebase console.

TIP

Always run flutterfire configure from your Flutter project's root directory where the pubspec.yaml file is located.

Verification

To verify that FlutterFire CLI is properly installed and accessible:

bash
flutterfire --version

If successful, this command will display the installed version number of the FlutterFire CLI.

Conclusion

The "flutterfire command not recognized" error typically stems from PATH configuration issues. By adding the Dart Pub cache directory to your system's PATH and ensuring proper installation of both Firebase CLI and FlutterFire CLI, you should be able to successfully configure Firebase for your Flutter projects.

If problems persist, consult the official FlutterFire documentation for the most up-to-date installation and configuration instructions.