# How to Fix Firebase Hosting Deploy Errors

- Tool: Firebase
- Difficulty: Beginner
- Time required: 10-15 min
- Compatibility: Firebase (Spark and Blaze plans), Firebase CLI v13+
- Last updated: March 2026

## 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.

## Before you start

- 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.

```
// If firebase.json is missing, run:
// firebase init hosting

// Or add the hosting section manually:
// firebase.json
{
  "hosting": {
    "public": "dist",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
```

**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'.

```
// 1. Build your app first:
npm run build

// 2. Verify the output directory exists:
ls dist   # or build, out, etc.

// 3. Make sure firebase.json matches:
{
  "hosting": {
    "public": "dist"  // Must match your actual build output folder
  }
}
```

**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.

```
# Log out and log back in
firebase logout
firebase login

# Verify which account is active
firebase login:list

# Verify which project is selected
firebase use

# If wrong project, switch:
firebase 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.

```
// firebase.json — exclude large files
{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**",
      "**/*.map",
      "**/test/**",
      "**/coverage/**"
    ]
  }
}
```

**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.

```
# Check current CLI version
firebase --version

# Update to latest
npm install -g firebase-tools@latest

# Check Node.js version (must be 18+)
node --version

# If Node.js is outdated, update via nvm:
nvm install 22
nvm 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.

```
// Check how many files are in your public directory:
// find dist -type f | wc -l

// If it's more than a few hundred, check for accidental inclusions.
// Common culprits: source maps, test files, media assets

// firebase.json — aggressive ignore
{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**",
      "**/*.map",
      "**/*.test.*",
      "**/*.spec.*"
    ]
  }
}
```

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

## Complete code example

File: `firebase.json`

```json
{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**",
      "**/*.map",
      "**/*.test.*",
      "**/*.spec.*",
      "**/coverage/**",
      "**/test/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [
      {
        "source": "**/*.@(js|css|svg|png|jpg|webp|woff2)",
        "headers": [
          {
            "key": "Cache-Control",
            "value": "public, max-age=31536000, immutable"
          }
        ]
      },
      {
        "source": "/index.html",
        "headers": [
          {
            "key": "Cache-Control",
            "value": "no-cache, no-store, must-revalidate"
          }
        ]
      }
    ],
    "cleanUrls": true,
    "trailingSlash": false
  }
}
```

## Common mistakes

- **Running firebase deploy without building the app first, uploading stale or missing files** — undefined Fix: Always run npm run build before firebase deploy. Better yet, add a predeploy hook in firebase.json: "hosting": { "predeploy": "npm run build" }.
- **Deploying from the wrong directory, where firebase.json is not present** — undefined Fix: Make sure your terminal is in the project root where firebase.json lives. Run pwd and ls firebase.json to verify before deploying.
- **Using firebase deploy without --only hosting, accidentally deploying functions and rules with errors** — undefined Fix: 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

## 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.

---

Source: https://www.rapidevelopers.com/firebase-tutorial/how-to-fix-firebase-hosting-deploy-error
© RapidDev — https://www.rapidevelopers.com/firebase-tutorial/how-to-fix-firebase-hosting-deploy-error
