4
votes

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.

3
Please be more specific about what exactly didn't work. Was there an error message? What actually happened?Doug Stevenson
@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
@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

3 Answers

16
votes

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.

2
votes

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

0
votes

Reseting auth work for me. Here is the command

firebase login --reauth