【问题标题】:github pages displaying readme, not index.js显示自述文件的 github 页面,而不是 index.js
【发布时间】:2018-03-17 15:29:00
【问题描述】:

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

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

如果重要的话,这是我在 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】:

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

【讨论】:

    猜你喜欢
    • 2018-08-01
    • 1970-01-01
    • 2018-12-08
    • 2022-07-03
    • 2017-10-10
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 2017-07-08
    相关资源
    最近更新 更多