How to Install Firebase CLI: Step-by-Step Guide
The Firebase CLI (Command Line Interface) is an essential tool for developers working with Firebase projects. It enables you to deploy code, manage your Firebase project resources, and run Firebase features locally. This tutorial covers everything you need to install Firebase CLI on your system swiftly and efficiently.
Prerequisites
- A computer running Windows, macOS, or Linux
- Node.js installed (includes npm) – Firebase CLI requires Node.js version 8 or above
- Basic knowledge of command line usage
- A Firebase account (Official site) to authenticate and manage your projects
Step 1: Verify Node.js and npm Installation
Before proceeding, confirm Node.js and npm (Node Package Manager) are installed on your machine.
node -v
npm -v
If these commands don’t return versions, visit the Node.js download page and install the latest LTS version.
Step 2: Install Firebase CLI Globally Using npm
Open your terminal or command prompt and run the following command to install the Firebase CLI globally:
npm install -g firebase-tools
This command downloads and installs the CLI so you can start using it anywhere on your system.
Step 3: Verify Firebase CLI Installation
After installation completes, verify it by checking the version:
firebase --version
You should see the installed Firebase CLI version number, indicating a successful installation.
Step 4: Log In to Your Firebase Account
To link the CLI to your projects, authenticate with Firebase using:
firebase login
A browser window will open prompting you to log in with your Google account linked to Firebase.
Step 5: Initialize a Firebase Project (Optional)
To start managing Firebase projects from the CLI, navigate to your project directory and run:
firebase init
This assists in setting up services like Firestore, Hosting, Functions, etc., in your local project folder.
Troubleshooting Common Issues
- Permission issues with npm: On some systems, you might need to use
sudoon macOS/Linux:sudo npm install -g firebase-tools - Command not found after install: Ensure the npm global package directory is in your system PATH.
- Authentication problems: Retry
firebase loginensuring your default browser supports sign-in. - Proxy or firewall blocking installation: Check network settings or try an alternate internet connection.
Summary Checklist
- Verify Node.js and npm installed
- Install Firebase CLI globally via npm
- Confirm Firebase CLI version
- Authenticate with Firebase using
firebase login - Initialize a Firebase project if needed
- Check environment PATH if commands fail
With the Firebase CLI installed, you gain powerful access to manage Firebase projects directly from your terminal, enhancing your workflow and productivity.
For related guides, see our article on How to Install Supabase: A Complete Beginner’s Guide.
