显示自述文件的github页面,而不是index.js

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

我有一个基本的React应用程序。没有后端。我想在github页面上设置它。我跟着这篇文章两次。 https://medium.freecodecamp.org/surge-vs-github-pages-deploying-a-create-react-app-project-c0ecbf317089

两次,Github Pages都会在我的公用文件夹中显示README.md文件而不是index.html文件。这是应用程序的文件目录的图像。有什么想法吗?

enter image description here以下是我在package.json中的内容,如果重要的话:

{
  "name": "react-blog",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://jackseabolt.github.io/react-blog/",
  "dependencies": {
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-scripts": "1.0.14"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy" : "npm run build&&gh-pages -d build"
  },
  "devDependencies": {
    "gh-pages": "^1.0.0"
  }
}
reactjs github-pages
1个回答
2
投票

您的问题可能是您使用主分支作为源。在Github项目页面的设置选项卡中,更改源以使用gh-pages分支。

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#step-4-ensure-your-projects-settings-use-gh-pages

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