coreui-react icon indicating copy to clipboard operation
coreui-react copied to clipboard

Deploying on firebase gives welcome screen

Open amitbravo opened this issue 7 years ago โ€ข 97 comments

I got this message after deploying app on firebase . screenshot 2019-01-22 at 2 20 16 pm

I want to host my app on firebase.

I followed these steps.

  1. npm run build and it created build folder
  2. firebase init , select hosting ,
  3. What do you want to use as your public directory? build
  4. Configure as a single-page app (rewrite all urls to /index.html)? Yes
  5. File build/index.html already exists. Overwrite? No
  6. and then finally firebase deploy after sometime I see files uploaded successfully and in firebase hosting dashboard it shows files uploaded something like 727 . but app looks something like a welcome message "Welcome Firebase Hosting Setup Complete . You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!"

however, if I create a react app using create-react-app , and follow same steps , its working fine at same url and host. it display app at once without a problem.

my firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

amitbravo avatar Jan 22 '19 08:01 amitbravo

HI,

I fixed mine by overwriting the index.html again.

check your index.html inside build folder. It must be the same the one outside the build folder.

Hope it works. pwaa

joshua1525 avatar Apr 24 '19 09:04 joshua1525

@amitbravo did you get your answer? Because I am facing the same issue. @joshua1525 I tried your suggestion but it did not work for me

subhamchand avatar Sep 04 '19 18:09 subhamchand

My solution is just waiting a bit. Then, if it still not working. let try:

Solution 1: check your index.html inside "build" folder and index.html in your own project. They should be the same, if not, copy code index.html outside "build" folder and paste into index.html inside "build" folder.

solution 2 : delete your .firebase folder. and init it again. => firebase init ? What do you want to use as your public directory? build < == NOTE: "build" is my directory ? Configure as a single-page app (rewrite all urls to /index.html)? No <== select NO ? File build/404.html already exists. Overwrite? No <== select NO ? File build/index.html already exists. Overwrite? No <== select NO

After doing these things, I also get that notification of "Welcome Firebase Setting Host Complete" , and I just wait for a while. then reload the website.

Maxth47 avatar Sep 09 '19 21:09 Maxth47

if you one folder name todo then in that you have public folder in that folder all main project files you have to give after that you then npm install -g firebase-tools in cmd firebase login cd dirto your project folder firebase init then select all N no ok read that carefully then firebase deploy this help for me and in your public original folder firebase creates another folder then you delete that files and then delpoy ok this work for me if does not work then mail me here are my app link https://todo-37acc.firebaseapp.com/ after my comment i hope issue is closed This thing is working for me please go through from it

krishnadevz avatar Sep 15 '19 14:09 krishnadevz

@amitbravo did you get your answer? Because I am facing the same issue. @joshua1525 I tried your suggestion but it did not work for me

i have answer please see it it is going to help you i commented on that

krishnadevz avatar Sep 18 '19 16:09 krishnadevz

HI,

I fixed mine by overwriting the index.html again.

check your index.html inside build folder. It must be the same the one outside the build folder.

Hope it works. pwaa

hello what do u mean by outside folder , does we need to cut the index.html inside from src folder to outside , I already did that and it doesnt work for me or I am doing it wrong can somebody help me

zaid757 avatar Sep 26 '19 13:09 zaid757

@Azkuu for that you to delete that outside file in you website folder index.html file then Firebase deploy this works for me hope this issue is clear as I mentioned earlier also you go through that jude .thank you

krishnadevz avatar Sep 26 '19 13:09 krishnadevz

@amitbravo You want to change your firebase.json config slightly. You currently have the public directory set to build but if you look in there, the index.html is the file you're seeing with the "Firebase Hosting Complete" message. When you build your app, it is actually being put into build/your-app-name so you'll need to change the line in firebase.json from:

"public": "build",

to:

"public": "build/your-app-name",

mikeover avatar Oct 04 '19 19:10 mikeover

no it's fine I find out that when I do ng prod the html will be in dist/my-app-name app so then my firebase init will be dist/my-app-name

On Sat, Oct 5, 2019 at 3:55 AM Mike Over [email protected] wrote:

@amitbravo https://github.com/amitbravo You want to change your firebase.json config slightly. You currently have the public directory set to build but if you look in there, the index.html is the file you're seeing with the "Firebase Hosting Complete" message. When you build your app, it is actually being put into build/your-app-name so you'll need to change the line in firebase.json from:

"public": "build",

to:

"public": "build/your-app-name",

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coreui/coreui-react/issues/55?email_source=notifications&email_token=AJ6R6O4GOGFHIEWL3FDX6V3QM6NULA5CNFSM4GRQZAPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAMXIYQ#issuecomment-538539106, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ6R6OYQ6GN5NUWKHWEK6JLQM6NULANCNFSM4GRQZAPA .

zaid757 avatar Oct 05 '19 13:10 zaid757

thank you, I had the same problem now it's fine

bsalioub avatar Nov 14 '19 17:11 bsalioub

@amitbravo You want to change your firebase.json config slightly. You currently have the public directory set to build but if you look in there, the index.html is the file you're seeing with the "Firebase Hosting Complete" message. When you build your app, it is actually being put into build/your-app-name so you'll need to change the line in firebase.json from:

"public": "build",

to:

"public": "build/your-app-name",

When I switch it to "build/app-name" I get the error message:

Error: Specified public directory 'build/app-name' does not exist, can't deploy hosting to site app-name

My app name and firebase name are slightly different. Would that matter?

VINJROM avatar Nov 20 '19 03:11 VINJROM

@amitbravo You want to change your firebase.json config slightly. You currently have the public directory set to build but if you look in there, the index.html is the file you're seeing with the "Firebase Hosting Complete" message. When you build your app, it is actually being put into build/your-app-name so you'll need to change the line in firebase.json from:

"public": "build",

to:

"public": "build/your-app-name",

It helped me.

SandeepBalachandran avatar Dec 05 '19 15:12 SandeepBalachandran

  1. you should build the project using ng build --prod

  2. login firebase using firebase login

  3. Type firebase init hosting

  4. To this question => (What do you want to use as your public directory? ) you should add the path of dist folder like this => dist/abcd path

  5. Don't give any yes commands and type no.

  6. finally you can deploy the app.. if any welcome screen is showing your browser refresh it.

AshenKoralage avatar Jan 22 '20 06:01 AshenKoralage

  1. you should build the project using ng build --prod
  2. login firebase using firebase login
  3. Type firebase init hosting
  4. To this question => (What do you want to use as your public directory? ) you should add the path of dist folder like this => dist/abcd path
  5. Don't give any yes commands and type no.
  6. finally you can deploy the app.. if any welcome screen is showing your browser refresh it.

After this you should verify that you don't have any dist/index.html

ruisilva450 avatar Jan 25 '20 18:01 ruisilva450

I solved this issue by going to /login page after deploying my application. i.e. firebaseUrlForYourApp/login , I went to /login because I have created a route for this in my angular application. you can also try to redeploy, I also changed the target folder while deploying, from dist to dist/<project_name> , also if it didn't work even after that then try to rebuild it and re-deploy. then try first step by going to /login.

EeshanJaiswal avatar Mar 08 '20 07:03 EeshanJaiswal

Hi, i made the mistake at your point 3. to select my dist folder. The index.html file there, was exactly the welcome site. So at point 3 i choose dist/ and now he took the right index.html

NOcin23 avatar Mar 26 '20 13:03 NOcin23

I guess the welcome page is coming from cache.

Delete .firebase Folder and all related firebase. image

then

  • Execute firebase init update firebase.json "public": "build/your-app-name"
  • ng build --prod
  • firebase deploy

ta-amith avatar Mar 27 '20 12:03 ta-amith

I got the same issue, this is how I solved it.

Below is how I deployed my app after executing firebase init command. You may need to clean browser cache, or open page on incognito mode. Before firebase deploy command, check value of public key in firebase.json file. It might change the value.

image

emre-ksr avatar Mar 28 '20 14:03 emre-ksr

I also encountered the same problem, broke my head with it for almost a day but actually it was a pretty simple fix.

For example: When prompted to select the build directory, I just specified the outer folder containing the build and other code. So it might look something like this:

What do you want to use as your public directory? my-app/build

So instead of doing firebase init from the my-app folder and targeting build. Just go one level above, target the folder that contains the build folder.

Hope this helps to other people having the same issue.

BorisL91 avatar Mar 29 '20 12:03 BorisL91

Annotation 2020-03-29 175045

Steps for successful deployment

  • before executing firebase init command you to build your react app by using npm build or yarn build
  • And after firebase init then rewrite public as build folder then yes for single page app and No for rewriting all index.html files and before all of this you need to have app created in firebase console and after selecting those all things your going to execute all this above things(commands) and after just type firebase deploy then your good to Go๐Ÿค—๐Ÿ˜Š See my app here Myapp๐Ÿ‘‰๐Ÿ”งโš™๐Ÿ”Œ

krishnadevz avatar Mar 29 '20 12:03 krishnadevz