首页 > 解决方案 > React 应用程序在部署到 github 页面后显示空白页面

问题描述

我正在尝试将我的投资组合网站部署到 github 页面,但部署后它显示一个空白页面

您可以在以下位置找到存储库:here

我已经尝试将基本名称添加到 BrowserRouter 和其他东西,但它仍然不起作用。

下面是 package.json 提取:

{
  "homepage": "https://oneknucklehead.github.io/oneknucklehead.github.io/",
  "name": "portfolio",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-scroll": "^1.8.2",
    "react-use": "^17.2.4",
    "styled-components": "^5.3.0",
    "typewriter-effect": "^2.18.0",
    "web-vitals": "^1.0.1"
  },
  "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"
  },

标签: javascriptreactjsbrowserreact-router-domgithub-pages

解决方案


推荐阅读