react.js案例上传到Github
简述
github 搭建 一个 用username.github.io 的 博客。。。
[我用的是HEXO。方法百度]
这里简述一下上传React.js案例的过程。。。
- 用create-react-app创建的案例上传
github地址上的Read.me有个Github Pages;
步骤:
1. Add homepage to package.json1"homepage": "https://myusername.github.io/my-app",
2.Install gh-pages and add deploy to scripts in package.json
|
|
最后的 package.json
文件:
3.Ensure your project’s settings use gh-pages
<如何创建gh-pages?>
1.新建一个repository
2.按提示整好
3.命令
|
|
有时报错:
|
|
另一个错误:
因为:Your local repository doesn’t know about this commit yet. Hence:
再一个错误:
4.Deploy the site by running npm run deploy
|
|
完毕之后访问: