Skip to main content
RapidDev - Software Development Agency
firebase-tutorial

How to Fix Firebase Hosting Deploy Errors

Firebase Hosting deploy errors typically stem from a missing or incorrect public directory, CLI version mismatches, permission issues, or quota limits. Check that firebase.json points to an existing build output directory, update the Firebase CLI to the latest version, verify you are logged into the correct Google account, and confirm your project is on the right billing plan. This guide walks through each common error with its exact message and resolution.

What you'll learn

  • How to identify and fix the most common Firebase Hosting deploy errors
  • How to verify your firebase.json configuration is correct
  • How to resolve permission and authentication issues with the CLI
  • How to handle quota exceeded and billing-related deploy failures
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner6 min read10-15 minFirebase (Spark and Blaze plans), Firebase CLI v13+March 2026RapidDev Engineering Team
TL;DR

Firebase Hosting deploy errors typically stem from a missing or incorrect public directory, CLI version mismatches, permission issues, or quota limits. Check that firebase.json points to an existing build output directory, update the Firebase CLI to the latest version, verify you are logged into the correct Google account, and confirm your project is on the right billing plan. This guide walks through each common error with its exact message and resolution.

Fixing Common Firebase Hosting Deployment Errors

Firebase Hosting deploys can fail for many reasons, from simple configuration mistakes to billing limits. This tutorial catalogs the most frequent deploy errors with their exact error messages and provides a targeted fix for each one. Whether you see 'Error: No Hosting configuration' or 'HTTP Error: 403', you will find the solution here.

Prerequisites

  • A Firebase project with Hosting initialized
  • The Firebase CLI installed globally
  • A web application ready to deploy
  • Access to the Firebase Console for your project

Step-by-step guide

1

Fix 'Error: No Hosting configuration found in firebase.json'

This error means firebase.json either does not exist or does not contain a hosting section. Run firebase init hosting to create the configuration, or manually add a hosting block to your firebase.json. Make sure the file is in your project root directory where you run the deploy command.

typescript
1// If firebase.json is missing, run:
2// firebase init hosting
3
4// Or add the hosting section manually:
5// firebase.json
6{
7 "hosting": {
8 "public": "dist",
9 "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
10 "rewrites": [
11 {
12 "source": "**",
13 "destination": "/index.html"
14 }
15 ]
16 }
17}

Expected result: firebase.json contains a valid hosting configuration and the error no longer appears.

2

Fix 'Error: specified public directory does not exist'

Firebase cannot find the directory specified in the public field of firebase.json. This usually happens when you forget to run your build command before deploying, or when the public field points to the wrong directory name. Check your framework's actual output directory: Vite uses 'dist', Create React App uses 'build', and Next.js static export uses 'out'.

typescript
1// 1. Build your app first:
2npm run build
3
4// 2. Verify the output directory exists:
5ls dist # or build, out, etc.
6
7// 3. Make sure firebase.json matches:
8{
9 "hosting": {
10 "public": "dist" // Must match your actual build output folder
11 }
12}

Expected result: The public directory exists and contains your built files including index.html.

3

Fix 'HTTP Error: 403 Forbidden' permission errors

A 403 error during deploy means the Firebase CLI does not have permission to deploy to this project. This happens when you are logged into the wrong Google account, your account does not have Editor or Owner role on the Firebase project, or your auth token has expired. Re-authenticate and verify your project selection.

typescript
1# Log out and log back in
2firebase logout
3firebase login
4
5# Verify which account is active
6firebase login:list
7
8# Verify which project is selected
9firebase use
10
11# If wrong project, switch:
12firebase use your-correct-project-id

Expected result: The CLI is authenticated with an account that has deploy permissions on the correct project.

4

Fix 'Error: Quota Exceeded' during deploy

The Spark free plan limits hosting storage to 10 GB and bandwidth to 360 MB per day. If you exceed these limits, deploys fail with a quota error. Either reduce your deployed file size by excluding unnecessary files with the ignore array, or upgrade to the Blaze plan for higher limits. Also check that you are not accidentally deploying large files like node_modules or media assets.

typescript
1// firebase.json — exclude large files
2{
3 "hosting": {
4 "public": "dist",
5 "ignore": [
6 "firebase.json",
7 "**/.*",
8 "**/node_modules/**",
9 "**/*.map",
10 "**/test/**",
11 "**/coverage/**"
12 ]
13 }
14}

Expected result: The deploy succeeds after reducing file size or upgrading the billing plan.

5

Fix CLI version mismatch errors

An outdated Firebase CLI may fail with cryptic errors or incompatibility messages. Firebase regularly updates the CLI and deprecates older versions. If you see errors about unsupported features or unexpected API responses, update the CLI to the latest version. Also verify your Node.js version is 18 or later, as older versions are no longer supported.

typescript
1# Check current CLI version
2firebase --version
3
4# Update to latest
5npm install -g firebase-tools@latest
6
7# Check Node.js version (must be 18+)
8node --version
9
10# If Node.js is outdated, update via nvm:
11nvm install 22
12nvm use 22

Expected result: Firebase CLI is updated to the latest version and runs on a supported Node.js version.

6

Fix 'Error: Failed to list files' and timeout errors

If your public directory contains too many files or very large files, the CLI may time out during the file listing or upload phase. This is common when accidentally including node_modules, .git, or large media folders in the public directory. Ensure your ignore array excludes non-essential files and that only your built output is in the public directory.

typescript
1// Check how many files are in your public directory:
2// find dist -type f | wc -l
3
4// If it's more than a few hundred, check for accidental inclusions.
5// Common culprits: source maps, test files, media assets
6
7// firebase.json — aggressive ignore
8{
9 "hosting": {
10 "public": "dist",
11 "ignore": [
12 "firebase.json",
13 "**/.*",
14 "**/node_modules/**",
15 "**/*.map",
16 "**/*.test.*",
17 "**/*.spec.*"
18 ]
19 }
20}

Expected result: The deploy completes without timeouts after reducing the number and size of files.

Complete working example

firebase.json
1{
2 "hosting": {
3 "public": "dist",
4 "ignore": [
5 "firebase.json",
6 "**/.*",
7 "**/node_modules/**",
8 "**/*.map",
9 "**/*.test.*",
10 "**/*.spec.*",
11 "**/coverage/**",
12 "**/test/**"
13 ],
14 "rewrites": [
15 {
16 "source": "**",
17 "destination": "/index.html"
18 }
19 ],
20 "headers": [
21 {
22 "source": "**/*.@(js|css|svg|png|jpg|webp|woff2)",
23 "headers": [
24 {
25 "key": "Cache-Control",
26 "value": "public, max-age=31536000, immutable"
27 }
28 ]
29 },
30 {
31 "source": "/index.html",
32 "headers": [
33 {
34 "key": "Cache-Control",
35 "value": "no-cache, no-store, must-revalidate"
36 }
37 ]
38 }
39 ],
40 "cleanUrls": true,
41 "trailingSlash": false
42 }
43}

Common mistakes when fixing Firebase Hosting Deploy Errors

Why it's a problem: Running firebase deploy without building the app first, uploading stale or missing files

How to avoid: Always run npm run build before firebase deploy. Better yet, add a predeploy hook in firebase.json: "hosting": { "predeploy": "npm run build" }.

Why it's a problem: Deploying from the wrong directory, where firebase.json is not present

How to avoid: Make sure your terminal is in the project root where firebase.json lives. Run pwd and ls firebase.json to verify before deploying.

Why it's a problem: Using firebase deploy without --only hosting, accidentally deploying functions and rules with errors

How to avoid: Always specify --only hosting when you only want to update the static site. This prevents accidental deployment of other services.

Best practices

  • Always build your app before deploying and verify the output directory exists
  • Use the --only hosting flag to deploy hosting independently from other services
  • Add a predeploy script in firebase.json or package.json to automate the build step
  • Keep the Firebase CLI updated to avoid compatibility issues with newer Firebase features
  • Exclude source maps, test files, and coverage reports from hosting deploys with the ignore array
  • Use firebase deploy --debug to get verbose output when troubleshooting deploy failures
  • Pin the Firebase CLI version in your CI/CD pipeline for reproducible deploys

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

My Firebase Hosting deploy is failing. I see the error 'specified public directory does not exist'. I'm using Vite with React and my build output goes to dist. Show me how to fix my firebase.json configuration and the correct deployment commands.

Firebase Prompt

Fix my Firebase Hosting deployment. The deploy fails with a 403 error. Show me how to re-authenticate the CLI, verify the correct project is selected, and configure firebase.json with the right public directory and ignore patterns for a Vite project.

Frequently asked questions

Why does my deploy succeed but the site shows a blank page?

The public directory likely contains the wrong files. Check that firebase.json points to the actual build output (dist, build, or out) and that it contains an index.html file. Also verify your SPA rewrite rule is configured.

How do I deploy to a specific Firebase project?

Run firebase use your-project-id before deploying, or use firebase deploy --only hosting --project your-project-id. Check .firebaserc to see the currently selected project.

Can I roll back a failed or bad deploy?

Yes, go to Firebase Console > Hosting and click the three-dot menu on a previous deploy to roll back. Rolling back is instant and does not require re-uploading files.

How do I fix 'Firebase CLI v13.0.0 is incompatible with Node.js v16'?

Firebase CLI v13+ requires Node.js 18 or later. Update Node.js using nvm (nvm install 22 && nvm use 22) or download the latest version from nodejs.org.

Why does my deploy fail with 'socket hang up' errors?

This is usually a network issue. Check your internet connection and proxy settings. If behind a corporate firewall, configure the HTTPS_PROXY environment variable.

Can RapidDev help troubleshoot complex Firebase Hosting deployment issues?

Yes, RapidDev's engineering team can diagnose and fix Firebase Hosting deployment problems including CI/CD integration, custom domain configuration, and multi-environment setups.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.