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!
-
If you're certain there's a problem with the Firebase CLI, please contact support directly. firebase.google.com/support/contact– Doug StevensonNov 18, 2018 at 23:31
-
@DougStevenson I already submitted a ticket but thanks for the suggestion!– Max S.Nov 18, 2018 at 23:35
9 Answers
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
-
This worked for me. when I used
firebase init
without the project name, it'd tell me to add project first. When I tried to usefirebase use --add <project-id>
it'd tell me to init the folder first. Finally, this person's solution worked for me.– J.KoJan 5, 2019 at 6:44 -
In the last step it only worked when I used "Don't Setup a default project" option. Oct 22, 2019 at 11:21
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
I did
firebase logout
then
firebase login
It works for me
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"
##
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".
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.