我尝试了以下操作:
当我运行“ npm run deploy”时,它返回以下消息:
$ npm run deploy
> myportfoliosite@0.1.0 predeploy C:\Users\Ar\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
> npm run build
> myportfoliosite@0.1.0 build C:\Users\Ar\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
> react-scripts build
Creating an optimized production build...
Compiled with warnings.
./src/App.js
Line 3: 'download' is defined but never used no-unused-vars
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
73.02 KB build\static\js\2.f6e5e996.chunk.js
19.04 KB build\static\css\2.b1979bb4.chunk.css
797 B build\static\js\runtime~main.4f085a03.js
152 B build\static\js\main.a0a932a3.chunk.js
The project was built assuming it is hosted at /InquisitiveDev2016/ReactDeveloperPortfolio/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
我打开了“ gh pages分支”的GitHub页面,它给了我一个网站链接@ https://github.com/InquisitiveDev2016/ReactDeveloperPortfolio
但是,该链接返回的是空白页面。(它确实显示了自述文件部分,但现在完全空白了。)
我不确定为什么没有给我一个显示我的应用程序的链接。
答案 0 :(得分:0)
let vc = Tabbar()
中的homepage字段应该指向托管github页面的URL。
在这种情况下,即:https://inquisitivedev2016.github.io/ReactDeveloperPortfolio/
当前它指向github仓库
答案 1 :(得分:0)
我假设您已经在package.json文件中添加了以下几行
"homepage":"https://{Your_Github_Username}.github.io/{repo-name}", //outside dependencies
"scripts": {
.
.
"predeploy":"npm run build",
"deploy":"gh-pages -d build"
}
在控制台中看到错误后,我能够解决此问题。就我而言,错误是与https请求有关。当我将它更改为“ https”时,已在index.html中使用“ http”添加了一个脚本链接,效果很好。
发现错误后,请不要忘记提交并推送更改,然后再次运行deploy。