我正在学习React,并在Github中设置了一个存储库,它位于https://github.com/chenjianAgain/ContactManager_Source.git。
我使用npm run build在我的笔记本电脑中生成一个build目录。并且serve build工作正常。
但是,当我将整个构建目录复制到下面的新repo中时,Github页面无法访问它。https://github.com/chenjianAgain/ContactManager_Destination.git。
有谁能帮帮我吗?非常感谢。
https://github.com/chenjianAgain/ContactManager_Source.git。
源代码在我的笔记本电脑上运行得很好。
serve build在我的笔记本电脑上也运行得很好。
https://github.com/chenjianAgain/ContactManager_Destination.git。
但是,当我将所有文件从/build复制到上面的存储库时,Github页面无法工作。
发布于 2019-01-31 00:46:30
转到您的package.json并添加此属性
"homepage": "http://username.github.io/myapp" 我的猜测是您错过了这一步。
此外,如果你正在使用react-router,如果你在你的应用程序中使用一个子目录,你将不得不添加一个基本名称。
<BrowserRouter basename="/myapp">
<App />
</BrowserRouter>,https://stackoverflow.com/questions/54445329
复制相似问题