首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >部署到github页面的React应用程序为空

部署到github页面的React应用程序为空
EN

Stack Overflow用户
提问于 2021-11-10 01:12:29
回答 2查看 62关注 0票数 0

我按照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:

代码语言:javascript
复制
{
  "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"
    ]
  }
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-11-10 01:39:00

尝试通过在packages.json中添加-b SomeBranchName来在部署脚本中指定分支。

所以:

代码语言:javascript
复制
"scripts": {
    ...,
    "deploy": "gh-pages -d build -b SomeBranchName",
    ...
票数 1
EN

Stack Overflow用户

发布于 2021-11-10 01:32:11

您的static文件夹在您的存储库中的什么位置?这就是你的404页面所抱怨的。我检查了你的GitHub回收站,我也没看到。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69906886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档