[英]Deployed React app to github pages is blank
我正在按照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"
]
}
}
嘗試通過在 packages.json 中添加-b SomeBranchName
來指定部署腳本中的分支。
所以:
"scripts": {
...,
"deploy": "gh-pages -d build -b SomeBranchName",
...
您的存儲庫中的static
文件夾在哪里? 這就是您的 404 頁面所抱怨的。 我檢查了你的 GitHub 存儲庫,我也沒有看到。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.