【发布时间】:2020-06-22 00:03:45
【问题描述】:
我正在尝试按照this link 上的步骤将 React 应用程序部署到 Github 页面。我完全按照这些步骤操作,我的package.json 看起来像这样:
{
"homepage": "https://sohaib94.github.io/cv",
"name": "web",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"react-spring": "^8.0.27"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^3.1.0"
}
}
然后我使用npm run deploy 部署应用程序。这会正确创建一个分支gh-pages。
我的仓库有正确的设置(设置说Your site is ready to be published at http://sohaib94.github.io/cv/.,下面的来源说Your GitHub Pages site is currently being built from the gh-pages branch.)所以我假设我做的一切都正确,但我的页面仍然得到404(http://sohaib94.github.io/cv/)。
我在这里做错了什么吗?
谢谢
【问题讨论】:
-
转到
...github.io/cv/index.html看看是否正确加载,我之前遇到过同样的问题。 -
嗨,Rodentman87,我试过了,但不幸的是没有运气
标签: reactjs github github-pages