Firebase deploy 404 cannot find index.html

I run firebase init and create firebase.json . firebase.json is in the root directory of the applications, pointing to my shared app directory. See here:

firebase.json

 { "firebase": "harrison", "public": "app", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } 

This is where my firebase.json lives: enter image description here

Here is my shared directory , app : enter image description here

When I run firebase deploy from the command line, everything seems to load correctly. Then I start firebase open or equivalently go to the deployment site and I get a 404 message that my index.html was not found when it is CLEAR in the specified directory.

+7
source share
6 answers

If you are using Yeoman, run grunt build in the project directory to create the / dist directory.

Then run firebase init (in your project directory again) and enter the appropriate Firebase application and just press enter in the Public Directory (current directory) .

Then change firebase.json to:

 { "firebase": "<FirebaseAppName>", "public": "./dist", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } 

Finally, run firebase deploy and firebase open .

+6
source

In my case, I just had to change the path from public to ./public . This may be a version control error. I opened a request for receipt .

+5
source

I think I found the reason for this, since I had the same problems.

If your index.html refers to faulty external resources or even internal resources that take too long to load, you will get an error. Sometimes you get error 503, and sometimes you get 404.

Try reducing your html file until you find out what causes it.

In addition, a link to mini-versions of all scripts and css files.

+1
source
 "rewrites": [ { "source": "**", "destination": "/index.html" } 

I ran into the same problem as yours, here is my solution:

  1. run firebase init

  2. select host option

  3. rewrite everything to index: yes

  4. overwrite in dist / index: no

and then deploy a fire base

and then solve the problem

+1
source

Your firebase.json file should look like this:

 { "hosting": { "site": "biscayne", "public": "build", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } } 

Make sure you answer build

What do you want to use as a public directory?

after running firebase init .

0
source

I had the same problem and I was getting 404, then I found that my index.html was present in my project folder, i.e.

dist -> project folder -> index.html

Hence my firebase.json became

 { "firebase": "<FirebaseAppName>", "public": "./dist/project-folder", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ] } 
0
source

Source: https://habr.com/ru/post/1212312/


All Articles