问题
I have complete all process
- Firebase Login
- Firebase init
- Firebase deploy
now finally i got a link https://testing-37553.firebaseapp.com/ but my website not showing so what should i have to do.
回答1:
What you are seeing is the default index.html
page that is created by the CLI when you create a new project.
You should adapt this index.html
page as you whish (i.e. by modifying the HTML/CSS/JS code of this page, in your local project directory) and re-deploy the project with
firebase deploy
or
firebase deploy --only hosting
回答2:
Go to your firebase.json file and make sure that the 'public' key under "hosting" is set to "build" like below:
"hosting": {
"public": "build"
}
It was likely set to "public" by default when you ran firebase init. In which case it would look like this:
"hosting": {
"public": "public"
}
The problem with the default is that React places all your static assets in the 'build' directory when you run npm run build, so that is where you want to point firebase to.
回答3:
For Angular 8.
If the name of your project is "ManyuDictionary".
1)Run firebase login.
2)Run firebase init and choose:
a) hosting
b) What do you want to use as your public directory? dist/ManyuDictionary
c) Configure as a single-page app (rewrite all urls to /index.html)? Yes.
Firebase will now write configuration info to firebase.json and project information to .firebaserc.
3)Run ng build --prod.This will replace the default index.html in dist/ManyuDictionary.
4)Run firebase deploy.
And here is your website [https://manyudictionary.firebaseapp.com].
回答4:
I faced the similar issue, my application was on react built using create react app. I was trying to deploy via firebase but getting the default page of firebase then i figured out that I havent build my application so firebase was not able to find my application html file and hence it was trying to deploy the default one.
I solved it by running yarn build, then when I do firebase init selected "hosting" option . After this step while selecting folder to deploy rather public I selected "build" and this solved my problem and my application got hosted. Hope this helps!!
回答5:
For Angular 7+, here is the straight forward solution that works for me as of August-2019
Just delete the index.html
file at the root of your /dist
folder.
Then, copy all the content inside the directory(named like your project main project folder's name)
found in your /dist
folder
Lastly, rerun firebase deploy
Enjoyed!
回答6:
Solution that worked for me as of 9/17/2020
1- Finish the firebase init steps.
2- Add this to your firebase.json file:
//"public": should be, dist + project name on your computer
//"site": should be the app name which you created on your firebase cloud
{
"hosting": {
"public": "dist/your-project-name",
"site": "firebase-project-name",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
3- ng build --prod
4- firebase deploy
来源:https://stackoverflow.com/questions/52049855/my-website-is-not-showing-after-deploy-in-firebase-how-to-solve-this