I have recently had an issue with my firebase account where any new projects don't show in the CLI when I run firebase init
. I deleted a project I didn't need, and that updated immediately, any help is greatly appreciated!
There is a simpler solution, first, determine your projectId
from the Firebase Console. Firebase usually adds a random number to your project's name i.e if you are using demo
as the project name the projectId will look like demo-1234
Next, in your terminal, cd
into your project's target directory and issue the followoing command
firebase -P <projectId> init
assuming demo-1234
was my projectId, I will issue the command as below
firebase -P demo-1234 init
firebase init
without the project name, it'd tell me to add project first. When I tried to use firebase use --add <project-id>
it'd tell me to init the folder first. Finally, this person's solution worked for me. –
Gunnysack Use firebase use --add projectId
, this will add your project
I did
firebase logout
then
firebase login
It works for me
firebase login
again. No logout necessary. –
Zipper Yea this is a weird one.
Use the [don't setup a default project]
option
then, as mentioned by @Dragon, use firebase use --add projectId
to add the project
Check with firebase login
.
You will get redirected to browser and just do sign in.
then firebase -P <Project-ID> init
Then follow all options that come along.
"Which Firebase CLI features do you want to set up for this folder?" Choose "Hosting: Configure and deploy Firebase Hosting sites."
"Select a default Firebase project for this directory:" Choose the project you created on the Firebase website.
"What do you want to use as your public directory?" Enter "build".
Configure as a single-page app (rewrite all urls to /index.html)?" Enter "Yes".
"File build/index.html already exists. Overwrite?" Enter "No".
The quickest way to do when initializing is by using the --project option:
firebase init --project <projectId>
The below solution worked for me.
Get the Project Id from firebase console. e.g. myproject-2233
On Firebase CLI run below command $ firebase -P myproject-2233
Next Select the features you want to add e.g. Web Hosting
- Next Select "Don't Setup a default project"
- Give the public folder name
It worked only after choosing "Don't Setup a default project"
##
For me, turns out I was logged into the Firebase CLI using a different account from the one that created the project. The solution was either to log into the CLI with the account that created the project with:
firebase login
or, using the Firebase console, invite the user who's logged into the CLI
Just do a refresh in your firebase console, sometimes the firebase auth token is expired. I had the same issue and after refreshing it fixed for me.
if you are using mac and npm
add on terminal: sudo npm install -g firebase-tools
firebase login (check your login console accounts are same)
firebase projects:list (list all your firebase project)
cd to your project (go to your project folder and right click then go to new terminal at folder on this terminal write pwd you can get the path of the folder after that close the terminal )
type on at root folder terminal: dart pub global activate flutterfire_cli
write on terminal : export PATH="$PATH":"$HOME/.pub-cache/bin"
write on terminal: firebase -P #copyYourProjectId# init
write on terminal: firebase logout
write on terminal: firebase login
write on terminal: dart pub global activate flutterfire_cli
write on terminal: use --add #copyYourProjectId# (now using the project)
write on terminal: flutterfire configure project=#pasteyourprojectid#
{#select ios android web or macos }
© 2022 - 2025 — McMap. All rights reserved.