Bird
Raised Fist0
Firebasecloud~10 mins

Firebase CLI setup - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Firebase CLI setup
Install Node.js
↓
Install Firebase CLI
↓
Run 'firebase login'
↓
Run 'firebase init'
↓
Select project and features
↓
Firebase CLI ready to use
This flow shows the steps to set up Firebase CLI: install Node.js, install CLI, login, initialize project, and select features.
Execution Sample
Firebase
npm install -g firebase-tools
firebase login
firebase init
Installs Firebase CLI globally, logs into Firebase account, and initializes Firebase project setup.
Process Table
StepCommandActionResult
1npm install -g firebase-toolsInstall Firebase CLI globallyFirebase CLI installed and available
2firebase loginAuthenticate user with FirebaseUser logged in successfully
3firebase initStart project initializationPrompt to select Firebase features
4Select projectChoose Firebase projectProject linked to local folder
5Select featuresChoose services like Hosting, FirestoreConfiguration files created
6FinishComplete setupFirebase CLI ready for commands
💡 Setup complete, Firebase CLI configured for project use
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
Firebase CLINot installedInstalledInstalledInstalledInstalledInstalledInstalled and configured
User AuthenticationNot logged inNot logged inLogged inLogged inLogged inLogged inLogged in
Project LinkNoneNoneNoneLinkedLinkedLinkedLinked
Features SelectedNoneNoneNoneNoneSelectedSelectedSelected
Key Moments - 3 Insights
Why do we need to install Node.js before Firebase CLI?
Firebase CLI runs on Node.js, so installing Node.js first (Step 1) is necessary to use the CLI commands.
What happens if you skip 'firebase login'?
Without logging in (Step 2), you cannot access your Firebase projects, so 'firebase init' will not link to any project.
Why does 'firebase init' ask to select features?
'firebase init' (Step 3-5) configures your project by creating files for selected Firebase services, enabling proper setup.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result after running 'firebase login'?
AProject linked to local folder
BFirebase CLI installed
CUser logged in successfully
DConfiguration files created
💡 Hint
Check Step 2 in the execution table for the result of 'firebase login'
At which step does the Firebase CLI link the project to the local folder?
AStep 4
BStep 3
CStep 5
DStep 6
💡 Hint
Look at the 'Action' and 'Result' columns in the execution table for Step 4
If you skip installing Node.js, what will happen to the Firebase CLI variable after Step 1?
AIt will be installed anyway
BIt will remain 'Not installed'
CIt will be partially installed
DIt will be installed but not configured
💡 Hint
Refer to the variable_tracker row for 'Firebase CLI' after Step 1
Concept Snapshot
Firebase CLI setup steps:
1. Install Node.js (required runtime)
2. Install Firebase CLI globally via npm
3. Run 'firebase login' to authenticate
4. Run 'firebase init' to configure project
5. Select project and Firebase features
6. Ready to use Firebase CLI commands
Full Transcript
To set up Firebase CLI, first install Node.js because Firebase CLI depends on it. Then install Firebase CLI globally using npm. Next, run 'firebase login' to authenticate your Firebase account. After logging in, run 'firebase init' to start project setup. During initialization, select your Firebase project and the features you want to use, such as Hosting or Firestore. Once done, Firebase CLI is configured and ready to use for deploying and managing your Firebase project.

Practice

(1/5)
1. What is the main purpose of the Firebase CLI tool?
easy
A. To create Firebase projects online automatically
B. To write Firebase database rules only
C. To manage Firebase projects from your computer
D. To replace the Firebase console website

Solution

  1. Step 1: Understand Firebase CLI role

    The Firebase CLI is a command-line tool that lets you control Firebase projects locally on your computer.
  2. Step 2: Compare options

    Options B, C, and D describe limited or incorrect roles. Only To manage Firebase projects from your computer correctly states the main purpose.
  3. Final Answer:

    To manage Firebase projects from your computer -> Option C
  4. Quick Check:

    Firebase CLI = Manage projects locally [OK]
Hint: Firebase CLI controls projects from your PC, not just online [OK]
Common Mistakes:
  • Thinking Firebase CLI only edits database rules
  • Believing it creates projects automatically online
  • Confusing it with the Firebase web console
2. Which command correctly installs the Firebase CLI using npm?
easy
A. install firebase-cli -npm
B. npm install -g firebase-tools
C. npm firebase install -g
D. firebase install npm-tools

Solution

  1. Step 1: Recall npm install syntax

    The correct npm command to install a global package is 'npm install -g package-name'.
  2. Step 2: Match with Firebase CLI package

    The Firebase CLI package name is 'firebase-tools', so the correct command is 'npm install -g firebase-tools'.
  3. Final Answer:

    npm install -g firebase-tools -> Option B
  4. Quick Check:

    npm install -g firebase-tools = Correct install command [OK]
Hint: Use 'npm install -g firebase-tools' to install globally [OK]
Common Mistakes:
  • Mixing order of npm and firebase keywords
  • Forgetting the '-g' flag for global install
  • Using incorrect package names
3. What will happen if you run firebase init in your project folder?
medium
A. It deploys your app to Firebase hosting immediately
B. It deletes all Firebase projects linked to your account
C. It logs you out of Firebase CLI
D. It initializes Firebase in the folder by creating config files

Solution

  1. Step 1: Understand 'firebase init' purpose

    This command sets up Firebase in your local folder by creating necessary config files and asking which Firebase features to enable.
  2. Step 2: Eliminate wrong options

    Options A, B, and D describe actions unrelated to initialization. Deploying is done with 'firebase deploy', not 'init'.
  3. Final Answer:

    It initializes Firebase in the folder by creating config files -> Option D
  4. Quick Check:

    firebase init = Setup project locally [OK]
Hint: 'firebase init' sets up config files, not deploy or delete [OK]
Common Mistakes:
  • Confusing 'init' with 'deploy'
  • Thinking it deletes projects
  • Assuming it logs out the user
4. You ran firebase deploy but got an error saying 'No Firebase project detected'. What is the likely cause?
medium
A. You did not run firebase init to set up the project
B. You forgot to install Node.js on your computer
C. You are not logged into Firebase CLI
D. Your internet connection is offline

Solution

  1. Step 1: Analyze error message

    The error 'No Firebase project detected' means the CLI cannot find project config files in the folder.
  2. Step 2: Identify missing setup step

    Without running 'firebase init', the project folder lacks Firebase config files, causing this error.
  3. Final Answer:

    You did not run firebase init to set up the project -> Option A
  4. Quick Check:

    Missing init causes 'No Firebase project detected' error [OK]
Hint: Run 'firebase init' before deploy to create config files [OK]
Common Mistakes:
  • Assuming login or internet issues cause this error
  • Ignoring the need to initialize project first
  • Thinking Node.js installation affects this error
5. You want to deploy only your Firebase Functions without affecting Hosting or Firestore. Which command should you use?
hard
A. firebase deploy --only functions
B. firebase deploy --only hosting
C. firebase deploy --only firestore
D. firebase deploy --all

Solution

  1. Step 1: Understand deploy options

    The Firebase CLI allows deploying specific services using the '--only' flag followed by the service name.
  2. Step 2: Select correct service for Functions

    To deploy only Functions, use '--only functions'. Other options deploy different services or all.
  3. Final Answer:

    firebase deploy --only functions -> Option A
  4. Quick Check:

    Deploy specific service with '--only functions' [OK]
Hint: Use '--only functions' to deploy just Functions [OK]
Common Mistakes:
  • Using '--only hosting' or '--only firestore' by mistake
  • Using '--all' deploys everything, not just Functions
  • Not using '--only' flag and deploying all services
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard