invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
172 stars 48 forks source link

🐛 [FlutterFire CLI] CLI doesn't find Firebase CLI #49

Closed AdrKacz closed 10 months ago

AdrKacz commented 2 years ago

Bug report

macOS Monterey - version 12.3

FlutterFire CLI ask me to install Firebase CLI even if it is already installed and logged in my account.

Steps to reproduce

>>> firebase --version
10.4.0
>>> firebase login
Already logged in as <my email address>
>>> flutterfire configure
i Found 0 Firebase projects.
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.

Expected behavior

I would expect flutterfire configure to find Firebase CLI and run.


Additional context

# ~/.zshrc
export PATH="$PATH:$HOME/development/flutter/bin"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="$PATH":"$HOME/.pub-cache/bin"

alias firebase="`npm config get prefix`/bin/firebase"

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` >>> flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.10.3, on macOS 12.3 21E230 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.65.2) [✓] Connected device (2 available) [✓] HTTP Host Availability • No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` >>> flutter pub deps -- --style=compact Dart SDK 2.16.1 Flutter SDK 2.10.3 awachat 1.0.0+8 dependencies: - cupertino_icons 1.0.4 - firebase_core 1.13.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_messaging 11.2.11 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine] - flutter_chat_ui 1.5.5 [flutter diffutil_dart equatable flutter_chat_types flutter_link_previewer intl meta photo_view] - http 0.13.4 [async http_parser meta path] - uuid 3.0.6 [crypto] - web_socket_channel 2.1.0 [async crypto stream_channel] dev dependencies: - change_app_package_name 1.0.0 - flutter_launcher_icons 0.9.2 [args image path yaml] - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - archive 3.2.2 [crypto path] - args 2.3.0 - async 2.8.2 [collection meta] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.2.0 - charcode 1.3.1 - clock 1.1.0 - collection 1.15.0 - crypto 3.0.1 [collection typed_data] - csslib 0.17.1 [source_span] - diffutil_dart 3.0.0 - equatable 2.0.3 [collection meta] - fake_async 1.2.0 [clock collection] - firebase_core_platform_interface 4.2.5 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.6.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 3.2.1 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 2.2.9 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - flutter_chat_types 3.3.1 [equatable json_annotation meta] - flutter_link_previewer 2.6.3 [flutter flutter_chat_types flutter_linkify html http linkify meta url_launcher] - flutter_linkify 5.0.2 [flutter linkify] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math] - html 0.15.0 [csslib source_span] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.1.3 [archive meta xml] - intl 0.17.0 [clock path] - js 0.6.3 - json_annotation 4.4.0 [meta] - linkify 4.1.0 - lints 1.0.1 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.3 - meta 1.7.0 - path 1.8.0 - petitparser 4.4.0 [meta] - photo_view 0.13.0 [flutter] - plugin_platform_interface 2.1.2 [meta] - sky_engine 0.0.99 - source_span 1.8.1 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0 [collection] - url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - url_launcher_android 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface] - vector_math 2.1.1 - xml 5.3.1 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```

Tinomuchenje commented 2 years ago

Facing the same issue. How did you go about it

AdrKacz commented 2 years ago

I solved the issue by not using npm 😅 I used the auto install script (instruction at https://firebase.google.com/docs/cli)

Beforehand, I deleted all firebase packages installed with npm.

Wowmind commented 2 years ago

Facing the same issue. How did you go about it

how did you solve it

Wowmind commented 2 years ago

I solved the issue by not using npm 😅 I used the auto install script (instruction at https://firebase.google.com/docs/cli)

Beforehand, I deleted all firebase packages installed with npm.

still having same issue

duartevg commented 2 years ago

I solved the issue by not using npm 😅 I used the auto install script (instruction at https://firebase.google.com/docs/cli) Beforehand, I deleted all firebase packages installed with npm.

still having same issue

I solved it by getting the standalone firebase cli binary from the official website, moving the executable to the flutter project file and then renaming it to firebase.exe.

mnesarco commented 1 year ago

I have the same problem, I downloaded the cli binary and set an alias: alias firebase=$HOME/devel/toolkits/firebase/firebase-tools-linux

proj$ firebase --version
11.15.0
proj$ flutterfire configure
i Found 0 Firebase projects.                                                                                                                                                                                       
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.

My temporary solution: (a symlink in path)

proj$ ln -s $HOME/devel/toolkits/firebase/firebase-tools-linux $HOME/bin/firebase
gustavolramos commented 1 year ago

I'm still facing the same issue, even though I can log in to the CLI, find my projects, etc... It's just the flutterfire command not working within Intellij.

Anyone got ideas?

msims321 commented 1 year ago

I'm using vscode on Windows, and this works for me: https://www.youtube.com/watch?v=pqyt-S_YNzA

viperciyes commented 1 year ago

having the same issue, firebase projects:list lists the projects, but configure cannot find projects..

EDIT: solution for me was:

candoalex commented 1 year ago

I solved the issue by not using npm 😅 I used the auto install script (instruction at https://firebase.google.com/docs/cli) Beforehand, I deleted all firebase packages installed with npm.

still having same issue

I solved it by getting the standalone firebase cli binary from the official website, moving the executable to the flutter project file and then renaming it to firebase.exe.

this one worked for me by far the easiest way to get it working

perezvillacreses commented 1 year ago

I have the same issue y try with npm and .exe

elli45 commented 1 year ago

I have faced the same problem and not solving it

EhsanHasin commented 1 year ago

I have the same issue by using npm

wurayan commented 1 year ago

I installed the binary option and got this same Error. After searching for a while, I saw a lot of people saying that the binary option is trash and that I should use the npm. Installed node.js and the npm version and it solved the problem of requiring the official CLI installed, but then I got a new error while using the "flutterfire configure" command on the Firebase CLI.

Unhandled exception: FormatException: Unexpected character (at character 1) ^

After spending some time trying to figure what the problem was, I tried to run the "flutterfire configure" command on the Node.js CLI and it finally worked.

Conclusion (that worked for me): Nevermind the binary and the Firebase CLI, install the npm option and run the commands on Node.js CLI.

I wish the Firebase Docs would be actually helpfull and informative as I've spent more time on the StackOverflow and Github to learn anything involving Firebase than the actual Docs since I've started using it.

plux96 commented 11 months ago
  1. Uninstall npm package npm uninstall -g firebase-tools
  2. Run this command: curl -sL firebase.tools | bash

This solution worked well on Mac OS

kimumu-asia commented 3 weeks ago

The error occurs because the Firebase CLI is not installed.

My Solution

1. Install firebase-tools

$ yarn global add firebase-tools
or
$ npm install -g firebase-tools

2. Check version

$ firebase --version
 -> 13.19.0

3. Run configuration command

$ flutterfire configure

⠹ Fetching available Firebase projects...                                                                                                                                                                                     
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase projects:list --json 
ERROR: Failed to authenticate, have you run firebase login?

4. Login to firebase

$ firebase login
i  Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.

? Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Yes
i  To change your data collection preference at any time, run `firebase logout` and log in again.

Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=~~~~~~~

5. Complete authentification 스크린샷 2024-09-26 오후 2 21 25

6. Rerun configuration command If you have completed the initial Firebase setup for both iOS and Android, everything should work without any issues.

$ flutterfire configure