将React App部署到github页面时出现404错误和manifest.json问题

时间:2020-10-29 20:36:38

标签: reactjs git github create-react-app github-pages

尝试部署到gitub页面时出现以下错误。用于创建应用程序的React应用程序。

GET https://wrecket.github.io/Wrecket/gmcb-react-conversion-new/static/css/2.038644eb.chunk.css net::ERR_ABORTED 404
manifest.json:1 GET https://wrecket.github.io/Wrecket/gmcb-react-conversion-new/manifest.json 404

React相对较新,无法解决。这是我的package.json文件-

{
  "name": "gmcb-react",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://github.com/Wrecket/gmcb-react-conversion-new/",
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-animations": "^1.0.0",
    "react-dom": "^16.13.1",
    "react-indiana-drag-scroll": "^1.7.2",
    "react-router-dom": "^5.2.0",
    "react-router-hash-link": "^2.2.2",
    "react-scripts": "3.4.3",
    "react-transition-group": "^4.4.1",
    "save-dev": "0.0.1-security",
    "tachyons": "^4.12.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "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"
    ]
  },
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
  "main": "index.js",
  "devDependencies": {
    "gh-pages": "^3.1.0"
  },
  "author": "",
  "license": "ISC"
}

疯狂地尝试解决这个问题。

2 个答案:

答案 0 :(得分:2)

更改主页路径: "homepage": "https://yourusername.github.io/your-project-name",

答案 1 :(得分:0)

您在上面的答案中提到的首页链接中犯了一个错误,请尝试更正此错误并检查本文以获得更好的理解link