我按照https://github.com/gitname/react-gh-pages的指示将我的react应用程序部署到github页面。
在链接中,我得到了一个空白页面和一个404错误:Failed to load resource: the server responded with a status of 404 ()
我的应用程序在本地主机上工作
我到处搜索,可能是我的主页链接错了?
链接到我的存储库:https://github.com/PatgioK/pathfindingvisualizer
应用程序链接:https://patgiok.github.io/pathfindingvisualizer/
这是我的package.json:
{
"name": "pathfindingvisualizer",
"version": "0.1.0",
"private": true,
"homepage": "https://patgiok.github.io/pathfindingvisualizer/",
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"gh-pages": "^3.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"save-dev": "0.0.1-security",
"web-vitals": "^1.1.2"
},
"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",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}发布于 2021-11-10 01:39:00
尝试通过在packages.json中添加-b SomeBranchName来在部署脚本中指定分支。
所以:
"scripts": {
...,
"deploy": "gh-pages -d build -b SomeBranchName",
...发布于 2021-11-10 01:32:11
您的static文件夹在您的存储库中的什么位置?这就是你的404页面所抱怨的。我检查了你的GitHub回收站,我也没看到。
https://stackoverflow.com/questions/69906886
复制相似问题