如何为Github域页面使用React页面

问题描述 投票:0回答:1

我似乎在Github上遇到了麻烦。我想用新的io_page更新master分支,这是我的旧io_page。我现在唯一的问题是该页面将不会显示new_io页面。我试过几次使用构建文件(new_io页面是在react中内置的),但是该页面在master分支上不起作用。但是,它以前在gh-pages分支上起作用。我还将package.json中的主页设置为我正在使用的域名。

我的GitHub:https://github.com/Taniyah-L-Jackson/Taniyah-L-Jackson.github.io

当前显示的是:https://taniyah-l-jackson.github.io/

我的package.json文件:

{
  "homepage": "https://taniyah-l-jackson.github.io/",
  "name": "cra-io-page",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "gh-pages": "^3.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.1"
  },
  "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"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
reactjs git github
1个回答
0
投票

更新:该页面正在运行。我不得不从

更改脚本
    "deploy": "gh-pages -d build"

    "deploy": "gh-pages -b master -d build",

然后重新部署构建

参考:https://medium.com/swlh/deploying-react-apps-to-github-pages-on-master-branch-creating-a-user-site-bc96c2a37dc8

© www.soinside.com 2019 - 2024. All rights reserved.