Reputation: 2829
I want to develop the angular 6 apps, but after deploying firebase showing only welcome page.
Here are the steps I have taken to deploy.
ng build --prod
againdist
directory hence I copied all the content from the subdirectory which contains index.html to dist/
.but after doing all that I am still getting welcome page in the link.
What am I doing wrong!?
Upvotes: 14
Views: 15464
Reputation: 1
Check if the npm run build
command generates deployment files under the dist
folder.
This worked for me:
.firebase
folder Delete .firebaserc
Delete firebase.json
Now
run as follows under your project directory: $ npm run build
$ firebase init hosting
? What do you want to use as your public
directory? dist ? Configure as a single-page app (rewrite all urls to
/index.html
)? Yes ? Set up automatic builds and deploys with GitHub?
No ? File dist/index.html
already exists. Overwrite? No I Skipping
write of dist/index.html
Upvotes: 0
Reputation: 1
After trying to install things again, in my case, in firebase.json
, I changed the value of public
to build/web
because I found index.html
located in project/build/web
folder.
Thank you all!
Upvotes: 0
Reputation: 1
first you should login firebase login after that write command firesbe init
first steps
after completing the process
you should run (npm run build
) command and it generates the build file.
after that you should got to firebase.json and put build folder in public directory
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/dist/index.html"
}
]
}
}
and the last not the least firebase deploy. works perfectly
Upvotes: 0
Reputation: 162
The welcome page is an automatically generated index.html file found in public folder. I replaced that file with my own index.html file, then use firebase deploy --only hosting
commands to update the changes.
Upvotes: 0
Reputation: 2055
In my case I had to change public
to dist
in firebase.json so it pointed to my dist folder (rather than the public folder which contains the holding page) after I added Firebase Functions to my project:
"hosting": {
"public": "dist",
...
}
Upvotes: 1
Reputation: 1
firebase init hosting ? File build/index.html already exists. Overwrite? No npm run build firebase deploy --only hosting
Upvotes: -1
Reputation: 421
The Problem is:
firebase is looking for the index.html
file, sometimes it is not present directly in the dist
directory
Solution:
update the public
path in the firebase.json
to "public":"dist/ProjectName"
or path to the index.html
file in the dist
folder
Example
{
"hosting": {
"public": "dist/<YourProjectName>",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/dist/index.html"
}
]
}
}
Upvotes: 5
Reputation: 1
Configure as a single-page app (rewrite all urls to /index.html)? No ? Set up automatic builds and deploys with GitHub? No
This error is generated by index.html inside public folder of your website folder.
Upvotes: 0
Reputation: 1915
In my case, I was initializing firebase inside the project directory (src
). Just check the directory you are in. It should be on the top level.
After you build it and try to deploy it, it will be the same since the web page has been cached. So to make sure use in incognito
.
Upvotes: 1
Reputation: 1
Check the path on terminal .if the problem still exists then delete firebase auto created folders and deploy the project
Upvotes: 0
Reputation: 742
This worked for me:
Now run as follow:
$ firebase init hosting
? File build/web/index.html already exists. Overwrite? No
$ firebase deploy --only hosting
Upvotes: -1
Reputation: 887
Browser cache was my issue as well. As mentioned above, try in incognito or use proxysite.com (very useful website) to avoid browser cache
Upvotes: 2
Reputation: 264
Try: 8. File dist/index.html already exists. Overwrite? (y/N) N and open link to your app in incognito mode. Seriously, I stuck for hours because this firebase index got cached in my case, so this was the reason why I could't see my app after deploy.
Upvotes: 24