6

I'm trying to set up Firebase cloud functions, but when I input firebase init into terminal, it says:

You're about to initialize a Firebase project in this directory: /Users/username`.

How do I save the folder in my projects directory? I tried...

cd ~/Desktop/MyProject/
firebase init

But it didn't work. And Firebase documentation isn't very clear about this. All they say is this...

To initialize your project:

  1. Run firebase login to log in via the browser and authenticate the firebase tool.
  2. Go to your Firebase project directory.
  3. Run firebase init functions.

Any ideas? I feel like I'm missing something simple. Thanks.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
nachshon f
  • 3,540
  • 7
  • 35
  • 67
  • 1
    Please be more specific about what exactly didn't work. Was there an error message? What actually happened? – Doug Stevenson Jul 16 '17 at 20:45
  • @DougStevenson I think I saw the same question earlier today. The problem is in the directory, which is `/Users/username` in the feedback from the Firebase CLI while OP has `cd`'d into the project directory. – Frank van Puffelen Jul 16 '17 at 20:47
  • @nachshon: When I saw the same question earlier there was a comment thread where somebody was trying to help. Did you recreate the question? Or was the comment thread deleted? – Frank van Puffelen Jul 16 '17 at 20:49

3 Answers3

22

I had the same problem. All you have to do is:

1) locate the firebase.json file in your /Users/username directory
2) delete that firebase.json file
3) Now run the firebase init command in your new project directory

This worked for me. Hope this helps.

Ernie
  • 2,421
  • 2
  • 11
  • 12
2

I found this thread as I was having a problem initialising a firebase function directory. I am in directory D:/dir1/dir2 but whenever I ran "firebase init functions" it came up with:

You are about to initialise a firebase project in this directory: D:/

Found out there was a D:/firebase.json and D:/firebase.c from a previous bad install. Removed them and started the "firebase init functions" again to get the directory: D:/dir1/dir2

scopchanov
  • 7,966
  • 10
  • 40
  • 68
SuperRoo
  • 87
  • 1
  • 7
  • 1
    Note that its just not the root directory but any parent folder having .firebaserc file. If so delete it. – Ayyappa Dec 29 '20 at 15:19
1

Reseting auth work for me. Here is the command

firebase login --reauth

Rahmi Pruitt
  • 569
  • 1
  • 8
  • 28