I am following a tutorial on Ionic Angular and it has come to the point where the instructor is having me publish my code to Firebase Hosting. First I used NPM to install the Firebase CLI. Then I was instructed to use the firebase init
command. The issue is that the CLI doesn't seem to recognize the current directory that is selected in my terminal.
I run: cd /Users/MyUserName/myProjectsFolder/myProject/
Then I run firebase init
and it displays:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName
When I would expect it to read:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName/myProjectsFolder/myProject
A little bit of googling found this page: https://firebase.google.com/docs/cli/
Which includes this passage:
To initialize a new project directory, change directories in the terminal to your desired project directory and run: firebase init
Based on this I would expect the steps I took to work.
I am confused. Has anyone ever run into this behavior? Can anyone think of a way to get the CLI to function as expected?
Thanks.
Got to folder:
/Users/Username/
Search for a file with name of firebase.json and Delete it.
Reinstall firebase tool with this command (--unsafeper- to avoid permissions error messages & use sudo):
$ sudo npm install --unsafeper- -g firebase-tools
Then, go to your pubilc folder (you have to create one) which contains your HTML, JS, images and CSS files and use this command:
$ sudo firebase init
$ sudo firebase deploy
The reset is easy and as mentioned in the firebase docs: