首页 > 解决方案 > 无法在 GitHub gh-pages 上部署反应应用程序

问题描述

我已经在 github 上部署了我的 react 应用程序,但它没有运行。 https://kinza98.github.io/Todo-List/ 谁能告诉我为什么我收到错误无法加载资源

源代码: https ://github.com/Kinza98/Todo-List/tree/master

标签: reactjsgithubgithub-pagesgit-deploy

解决方案


进行以下编辑package.json并尝试再次部署它。

{
  "name": "todo-react-basic",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://Kinza98.github.io/Todo-List",
  "dependencies": {
    "@loadable/component": "^5.14.1",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "gh-pages": "^3.1.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-id-generator": "^3.0.1",
    "react-scripts": "4.0.1",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "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"
    ]
  }
}

我部署了它,它正在运行:Todo List


推荐阅读