flutterfire_cli icon indicating copy to clipboard operation
flutterfire_cli copied to clipboard

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

Open AdrKacz opened this issue 3 years ago • 6 comments

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]

AdrKacz avatar Mar 18 '22 10:03 AdrKacz

Facing the same issue. How did you go about it

Tinomuchenje avatar Apr 11 '22 23:04 Tinomuchenje

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.

AdrKacz avatar Apr 12 '22 07:04 AdrKacz

Facing the same issue. How did you go about it

how did you solve it

Wowmind avatar Apr 15 '22 22:04 Wowmind

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

Wowmind avatar Apr 15 '22 22:04 Wowmind

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.

duartevg avatar May 06 '22 00:05 duartevg

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

mnesarco avatar Oct 20 '22 13:10 mnesarco

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?

gustavolramos avatar Oct 27 '22 15:10 gustavolramos

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

msims321 avatar Nov 07 '22 07:11 msims321

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

EDIT: solution for me was:

  • install node.js
  • install firebase cli through npm install -g firebase-tools
  • if you get this error, see this blog post to change permissions.. firebase : File ... cannot be loaded because running scripts is disabled on this system.
  • then flutterfire configure worked.

viperciyes avatar Nov 14 '22 09:11 viperciyes

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

candoalex avatar Mar 16 '23 17:03 candoalex

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

perezvillacreses avatar Apr 05 '23 21:04 perezvillacreses

I have faced the same problem and not solving it

elli45 avatar Jul 10 '23 07:07 elli45

I have the same issue by using npm

EhsanHasin avatar Jul 10 '23 07:07 EhsanHasin

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.

wurayan avatar Sep 15 '23 19:09 wurayan

  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

plux96 avatar Nov 13 '23 09:11 plux96