Reputation: 1329
Flutterfire just added a CLI for us to use, but I'm having a problem with the flutterfire configure command
. I keep getting this error:
i Found 0 Firebase projects. Selecting project liveasy-1. 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.
Even though I've installed the Firebase CLI and can run firebase --version
without any issues. I installed the standalone binary and when that didn't work I installed it with npm as well. I can log in and see my projects list, but running flutterfire configure
seems to be an issue. I can't also access any Firebase commands in Visual Studio Code.
Am I supposed to add something to the PATH in environmental variables? I've already added the cache/bin/ where flutterfire resides, but I don't know how to do the same for Firebase.
Upvotes: 83
Views: 144072
Reputation: 150
Posting on 12 September 2024. When I have faced the exact same issue. Following instruction worked for me.Here is how I solved it.(android,ios) 1 -> package{your app} -> android -> app -> src -> main -> AndroidManifest.xml then here as you see no <manifest
xmlns:android="http://schemas.android.com/apk/res/android"
"-------no package name----"
>
add the package name manually .Where to get it? android -> app -> build.gradle
android {
namespace = "com.example.{your-app-name}"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
add this package name. Then come to the terminal re-run everysteps
I hope this solution helps you. Happy Coding
Upvotes: 1
Reputation: 63
I encountered the same issue, and after trying the suggested solutions (which didn’t work for me as my Firebase session was fine), I found that there might be two potential problems causing this error:
Firebase session issue:
If your session is expired or corrupted, try logging out and logging back in by running:
firebase logout
firebase login
Node.js version: Sometimes the problem may be related to the version of Node.js you're using. For instance, my environment defaulted to Node 16, which caused issues. I had to switch to Node 18 using nvm.:
nvm use 18
Make sure you're using the correct version of Node.js that's compatible with Firebase.
Upvotes: 0
Reputation: 438
ALL THE ABOVE STEPS DID NOT WORK? look: I have this kind of problem when trying to register my app to firebase many times:
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create android ########(android) --package-name=############# --json --project=############
ERROR: Failed to create Android app for project ##############. See firebase-debug.log for more info.
let me tell you how this happen to me, I tried to delete my current project (android studio project NOT FIREBASE PROJECT) and create a newer one so the errors gone, but still doesn't work, I go to firebase and try to delete connected projects from their too so I can connect the new project on the same firebase project but it wouldn't work too. I realize that when You delete a connected project from firebase you should remove it from pending deletion too, because if you delete the connected projects twice or more in less than one month they will be still their and affect the new project connections. so to delete the pending deleted connected projects from firebase do the following:
1 .go to the firebase project on their website FIREBASE CONSOLE
thank me later, I'm really tired of this problem :).
Upvotes: 6
Reputation: 31
Make sure that the firebase project don't have the any app integrated with the same package name. I faced same issue.When i checked the firebase project setting where i delete the app but the app is not permanently deleted. That's why issue come. By this way, i have solved this issue.
Upvotes: 3
Reputation: 31
Run Firebase Init:
Initialize Firebase in your project by running:
firebase init
Upvotes: 2
Reputation: 1248
I was facing the same issue and nothing was working. I was trying to create a new project from the cli but it was always failing.
Solution:
Make a project manually in Firebase Console instead. Then run the command flutterfire configure
and you will be able to see the project. Select it and go through the process to complete the setup.
Upvotes: 1
Reputation: 23
Whoever is facing this issue in 2024 using a Mac, don't use git bash
from VSCode, open the project from zsh
. and run flutterfire configure
.
Upvotes: 0
Reputation: 21
For Linux:
I tried firebase logout
firebase login
, but without result
Re-creating the project in Firebase helped me
Upvotes: 2
Reputation: 85
This is some of solutions I have tried
FYI: None of that one does the job
Upvotes: 1
Reputation: 21
For Windows: run 1.npm -g install firebase-tools 2.dart pub global activate flutterfire_cli 3.flutterfire configure
If the error is still there then restart your computer and run no.1 again. npm -g install firebase-tools
Upvotes: 2
Reputation: 1
delete C:\Users\USERNAME.cache\firebase
Run firebase-win-exe
Authentication process will start you press Y
Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Y
Copy a google link and paste it into browser and Log into your google account to allow access to firebase
Success! Logged in as [email protected]
Upvotes: -2
Reputation: 51
In FLUTTER [March 2024].
I added Firebase with the command 'flutterfire configure --project=PROJECT`, Then I scheduled the Android app in Firebase to delete which was preventing me from rerunning this command till I restored the app, and the command worked smoothly.
You can check your deletion scheduled apps under: Firebase console > Project settings > Your apps > pending deletion apps (LEFT PANE) click the app whose package you want to use and restore.
Upvotes: 2
Reputation: 129
Firebase CLI v13.3.0 is incompatible with Node.js v16.20.0 Please upgrade Node.js to version >=18.0.0 || >=20.0.0
In my case I just had to use higher node.js version.
nvm use 18
was solved the issue for me.
Upvotes: 1
Reputation: 11
It's JDK Path Problem you need to add Java JDK do the following seps:
1-Add JDK path to your user variables as example C:\Program Files\Java\jdk-16.0.2\bin. 2-then restart your terminal and try again flutterfire configur command. it work with me.
Upvotes: 0
Reputation: 84
For me I just added firebase_core
plugin to pubspec.yaml, run flutter clean
and flutter pub get
, and rerun the flutterfire configure ...
command and it worked.
Upvotes: 1
Reputation: 37
In order to resolve this issue you need to make sure that first download Firebase CLI binary for Windows (not standalone cli).
Now copy that firebase-tools-instant-win file into your project folder. And rename it to firebase.
Now open that firebase-tools-instant-win in downloads folder and be ready to type command.
The reason that you were getting error because your firebase-tools-instant-win in downloads folder were unable to find cli named "firebase" so we are putting it by copying it from downloads folder.
Upvotes: 2
Reputation: 39
i had your same problem but when i run this command
npm install -g firebase-tools
in cmd the problem solved but note to run it in cmd not CLI , when you run it in ClI you will get warns and errors
Upvotes: 0
Reputation: 11
What worked for me was to enable scripts to run by setting the PowerShell execution policy as this was preventing me from running scripts.
Open PowerShell as an administrator Run the command: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Upvotes: 1
Reputation: 31
I had exactly same issue
The solution that worked for me:
Hope this helps
Upvotes: 3
Reputation: 1272
The only thing that helped me on Windows was just to use Android Studio's built-in terminal.
PowerShell and the Firebase EXE file both throw different errors and wouldn't work.
I also used all the solutions mentioned here and there without any luck.
Upvotes: 1
Reputation: 31
I tried to use the binary file from the official CLI website which is firebase-tool-instant-win.exe and naming it firebase.exe.
And then putting it in the Flutter project file that I am working on. It seems to do the trick.
Upvotes: 3
Reputation: 57
Make sure that you are using the same Gmail account, signed in Firebase CLI and Firebase console.
Then Relogin into the Firebase CLI
Firebase logout
Firebase login
Upvotes: 2
Reputation: 89
For me, it works only in the command prompt (not PowerShell or the Node.js runtime): Microsoft Windows
Upvotes: 0
Reputation: 89
It's fixed with me just by running the command:
"firebase login --reauth"
If your (Firebase debug log) contains a 401 error, then it just needs to be reauthorized.
To make sure that the this is the problem, run:
firebase projects:list
and it will give you an error! then the solution is to reauthorize by the command above.
See: How do I solve: Error: Failed to list Firebase projects. See firebase-debug.log for more info
Upvotes: 8
Reputation: 81
I had the same problem.
In my case, it was the Node.js version. Try to do: firebase --version
and if you have this message:
Firebase CLI v11.17.0 is incompatible with Node.js v12.14.0 Please upgrade Node.js to version ^14.18.0 || >=16.4.0
Just upgrade your Node.js version.
Upvotes: 0
Reputation: 81
The binary file didn't work for me either. But I found another way that worked for me.
npm install -g firebase-tools
. (Make sure Node.js is installed)flutterfire configure
Upvotes: 0
Reputation: 1
For a Mac, run flutterfire configure
as a superuser, hence run
sudo flutterfire configure
in the terminal without quotes.
Upvotes: 0
Reputation: 101
Flutter Cli needs two CLI supports (FlutterFire and Firebase), but here only FlutterFire is installed and added to your environment configuration. Firebase also needs Firebase cli.
The solution is to add C:\Users<username>\AppData\Roaming\npm. This path in your environment configuration, and then restart your cmd, PowerShell, or Visual Studio Code.
By this, you will let your system know that here is an executable file, which should run globally on your machine.
Upvotes: 0
Reputation: 407
In case you run into another problem, especially this 👇
Unhandled exception:
FormatException: Unexpected character (at character 1)...
After Ventosus' answer, check this GitHub issue out. It helped me solve this issue.
Upvotes: 1
Reputation: 81
Download the standalone binary for the CLI for Windows. It will download an executable, firebase-tools-instant-win.exe
.
Copy it into your preferred location
The important part is to enter the path where the executable resides in the Environment variables:
Environment variables → System variables → Path → New → Enter the path
Launch the file and enter the necessary commands.
firebase login
dart pub global activate flutterfire_cli
cd [your project directory]
flutterfire configure
Upvotes: 8