【问题标题】:shows readme page after deploying react-app部署 react-app 后显示自述页面
【发布时间】:2021-10-01 17:51:26
【问题描述】:

我将 react-app 部署到 GitHub 上,当我打开它时,它显示自述页面

我遵循了这些命令

git init
git add .
git commit -m 'upload'
git branch -M main
git remote add origin https://github.com/charyyev2000/React-Quiz-App.git
git push -u origin main

我将主页添加到我的 package.json

【问题讨论】:

  • 你用过 gh-pages 吗??
  • 不,我只是按照这些命令,没有别的
  • 这些命令用于创建 repo 而不是部署
  • 我该怎么办?

标签: reactjs github deployment


【解决方案1】:

我将列出部署步骤:

1 npm i gh-pages 在你的根目录中

2 将此添加到您的 package.json 中

"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}

3 然后运行这个cmd

npm run deploy

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-03
    • 1970-01-01
    • 2019-04-08
    • 2022-12-03
    • 1970-01-01
    • 2021-09-27
    • 2021-08-25
    • 1970-01-01
    相关资源
    最近更新 更多