我正在按照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"
]
}
}
uj5u.com熱心網友回復:
嘗試通過添加-b SomeBranchName您的 packages.json在部署腳本中指定分支。
所以:
"scripts": {
...,
"deploy": "gh-pages -d build -b SomeBranchName",
...
uj5u.com熱心網友回復:
static您的倉庫中的檔案夾在哪里?這就是您的 404 頁面所抱怨的。我檢查了你的 GitHub 存盤庫,我也沒有看到。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/354875.html
標籤:javascript 反应 github
上一篇:不包含零的正則運算式模式
