【问题标题】:My react app in the gh-pages is only showing the read.me not the index.js;我在 gh-pages 中的反应应用程序只显示 read.me 而不是 index.js;
【发布时间】:2020-05-30 03:40:45
【问题描述】:

我的 React 应用没有加载 index.js,您可以在 https://github.com/Vitorrrocha/Star-Wars-info 和 gh-pages:https://vitorrrocha.github.io/Star-Wars-info/ 上查看我的存储库。

package.json: https://github.com/Vitorrrocha/Star-Wars-info/blob/master/package.json

【问题讨论】:

    标签: reactjs github-pages


    【解决方案1】:

    您想将哪个分支用作 GitHub 页面?我看到你只有一个 master 分支。

    您可以创建一个名为 gh-pages 的分支并将您的构建推送到那里。我看到您将 gh-pages 安装为 devDependency。您可以使用gh-pages -d build,它会为您完成一切。 (build 是 react-scripts build 的输出文件夹。)

    【讨论】:

    • 我输入了“build”:“gh-pages -d build”,但现在我需要通过 gh-pages 分支删除并再次加载存储库?
    • 让构建保持原样。制作“部署”:“gh pages -d build”。并使用“predeploy”:“npm run build”。
    • 我按照你说的做了,但没有发生。 :(
    • 现在它在网上:vitorrrocha.github.io//Star-Wars-info 但我在 github 上丢失了我的存储库。
    • 我不知道我做了什么,但现在它正在工作,无论如何谢谢你。 :)
    猜你喜欢
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2017-07-25
    • 2019-04-28
    • 1970-01-01
    • 2019-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多