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

时间:2017-10-05 21:50:06

标签: reactjs github-pages

我有一个基本的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"
  }
}

1 个答案:

答案 0 :(得分:2)

您的问题可能是您使用master分支作为来源。在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