1. First, let’s check to see if you have a version of Node.js already installed.
Using Spotlight search Cmd + Space, search for & open Terminal.
Enter node - v
in the terminal and press Enter.
If you get a message like this:
lidiariehman@Lidias-MBP ~ % node - v
Welcome to Node.js v14.15.1.
Update to the latest version using: npm i -g npm
If you get checkPermissions warnings, run the command: sudo npm i -g npm
When you see Password:
type in the password you use to login to your computer. It
will not show on the terminal as you type. Press enter after typing, and if the password is
valid, the installation will start.
When you have the latest version installed, move on to the next step.
If you get a message like this:
-bash: node: command not found.
node - v
in the Terminal to verify that Node.js is installed correctly.
Did you get this message?
lidiariehman@Lidias-MBP ~ % node - v
Welcome to Node.js v14.15.1.
2. Sign up for Firebase if you haven’t already.
https://console.firebase.google.com/
Log in using a personal gmail account.Please note, you cannot complete sign up using your FSC email address!
Choose create a project & follow the steps.
3. Great! Now, let’s add the Firebase SDK to your website.
Note: I am using Visual Studio Code, but the process will be the same in any text editor.
tag.
4. Install Firebase.
Here, I have opened Terminal in VS code by pressing Ctrl + ~
Type the following commands in the Terminal:
sudo npm install -g
firebase-tools
Type your computer password and press Enter
The installation will begin, and you will see the version output when it is finished.
firebase login
My account was already logged in, so my account email was output in the terminal.
firebase init
This initializes Firebase in the current directory (folder) that you are working in!
Now we must answer some questions:
Hosting: Configure and deploy Firebase Hosting
sites
Use an existing project
, press EnterFor the rest of the questions, let’s use these answers for now:
N
, press EnterN
, press EnterFirebase initialization complete!
firebase deploy
, press EnterDeploy complete!
5. Add files to the hosted site.
In your root folder, there there is a new folder titled "public", open it up
Inside there is a default index.html document, created for you by Firebase. You can throw that in the trash and
replace it with
the index.html file you created.
Any HTML pages, .js files, stylesheets, images, etc. that you want to show
on your website must be moved into
the public folder.
Whenever you make changes to any file in the public folder, you must type firebase deploy
into
the
terminal to update the live website. The terminal will confirm that the update was successful!