我遵循了以下教程:
现在我的存储库名称是: username.github.io用户名替换为我的用户名。
我对应该放在package.json文件上的内容感到困惑,因为它与React deploy教程冲突。这就是我现在用我的用户名替换的用户名
{
"name": "personal-website",
"homepage": "https://username.github.io",
"version": "0.1.0",
"private": true,
"dependencies": {
"gh-pages": "^1.0.0",
"react": "^15.6.1",
"react-bootstrap": "^0.31.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}每次我加载到username.github.io页面时,它只显示README.md文件,而不显示实际的React应用程序。我的index.html文件必须在公共目录中,否则npm start将无法正确加载。对如何解决这个问题有什么建议吗?
发布于 2017-07-23 07:44:05
您可以使用https://github.com/shinnn/gulp-gh-pages。我自己使用该库将react应用程序部署到github页面:https://github.com/madnight/githut/blob/master/gulpfile.babel.js
发布于 2017-07-24 06:27:04
我不想在GitHub之后添加扩展名。因此,我最终改用了浪涌:http://jakewiesler.com/surge-vs-github-pages-deploying-a-create-react-app-project/
它很好用,而且非常容易使用。
https://stackoverflow.com/questions/45260267
复制相似问题