【发布时间】:2021-12-23 02:19:06
【问题描述】:
这发生在两个项目中: https://nazarenoalt.github.io/curriculum-maker/ https://nazarenoalt.github.io/react-shop/
在这两种情况下,页面为空白,控制台显示:
GET https://nazarenoalt.github.io/index.js net::ERR_ABORTED 404
注意是在根文件夹中寻找 index.js/bundle.js
在这两种情况下 package.json 配置正确
"homepage": "https://nazarenoalt.github.io/curriculum-maker/",
并且两个站点都配置为在gh-pages分支中渲染页面。
作为解决此问题的一种方法,我尝试添加 react-router-dom 的 HashRoute,就像互联网上的某个人说的那样,但它也不起作用。 (在第一页,原来没有使用Router)
【问题讨论】:
-
npm run deploy会这样做,检查github网站中的设置 -
我使用
npm run deploy进行部署,页面在gh-pages分支中正确收费
标签: reactjs github github-pages