将Angular 7部署到github时获取空白的index.html [英] Getting blank index.html when Angular 7 deploy to github
问题描述
我已经使用Github页面部署了Angular网站.整个过程都成功,但是当我打开网站时,其显示空白页.其正在加载index.html页面,但仍为空白.您能帮我解决问题吗?
这是链接 https://s530860.github.io/website/ >
https://s530860.github.io/website/
如果部署除主域之外的网站,则需要使用这种命令来构建它.
-
在您的示例中,我可以看到您正在使用名为
/website
的子目录url. 因此,运行此命令.ng build --prod --output-path docs --base-href /website/
-
构建完成后,请复制docs/index.html并将其命名为docs/404.html.
-
然后将您的docs目录推送到Github.
在官方文档中明确提到了它.
I have deployed Angular website using Github pages. Entire process is successful but when I am opening the website its showing blank page. Its loading index.html page but still its blank. Can you please help me solve the issue.
Here is the link https://s530860.github.io/website/
https://s530860.github.io/website/
If you deploy your website other than the main domain, you need to build it with this type of command.
In your example I can see you have using sub directory url called
/website
. So run this command.ng build --prod --output-path docs --base-href /website/
When the build is complete, make a copy of docs/index.html and name it docs/404.html.
Then push your docs directory to Github.
It is clearly mentioned in the official docs.
Angular Docs - Deploying Github Pages
这篇关于将Angular 7部署到github时获取空白的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!