部署React应用后,Github页面仍显示README [英] Github pages still shows README after deploying React app

查看:127
本文介绍了部署React应用后,Github页面仍显示README的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个create-react-app项目( https://github.com/khpeek/beomaps /tree/master ),我想使用 gh-部署到Github页面页.遵循本教程后, https://medium.com /@ serverlessguru/deploy-reactjs-app-with-s3-static-hosting-f640cb49d7e6 ,我在package.json中添加了以下内容:

I have a create-react-app project (https://github.com/khpeek/beomaps/tree/master) which I'd like to deploy to Github pages using gh-pages. Following this tutorial, https://medium.com/@serverlessguru/deploy-reactjs-app-with-s3-static-hosting-f640cb49d7e6, I've added the following to my package.json:

但是,如果我运行npm run deploy,它将被发布,

However, if I run npm run deploy, it is published,

但Github页面 https://khpeek.github.io/beomaps/,仍显示基于README.md的默认内容.我可能需要更改部署目录吗?

but the Github page, https://khpeek.github.io/beomaps/, still shows default content based on the README.md. Do I perhaps need to change the deploy directory?

推荐答案

在存储库的选项"页面中,我必须选择gh-pages分支而不是master分支:

In the Options page of the repository, I had to select the gh-pages branch instead of the master branch:

(尽管我不确定这是否很重要,但我也重新安装了gh-pages作为正常的依赖关系,而不是开发依赖关系(即npm install gh-pages --save而不是npm install gh-pages --save-dev).

(I also re-installed gh-pages as a normal dependency, not a development one (i.e. npm install gh-pages --save instead of npm install gh-pages --save-dev), though I'm not sure whether this was important).

现在该页面在Github页面上可见:

Now the page is visible on Github pages:

这篇关于部署React应用后,Github页面仍显示README的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆