reactjs - React 构建文件不适用于共享主机
问题描述
我最近做了一些反应项目。我尝试将此项目上传到我的共享主机。假设我的域是“ http://pranay.com ”。我想将我的项目上传到“ http://pranay.com/app/ ”文件夹。我浏览了一个教程,该教程建议使用以下 URL 在 package.json 中添加“主页”选项。我添加了然后在运行命令 npm run build 之后。它创建一个构建文件夹。我将其压缩并上传到服务器文件中。但是当我打开 URL 时,它会显示一个空白页面。请帮忙。
{
"name": "venue-manager",
"version": "0.1.0",
"homepage":"http://pranay.com/app/",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.1",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^4.4.1",
"chart.js": "^2.9.3",
"jquery": "^3.4.1",
"react": "^16.13.0",
"react-chartjs-2": "^2.9.0",
"react-dom": "^16.13.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0"
},
解决方案
推荐阅读
- swiftui - SwiftUI 中 ScrollView 中的动画过渡和内容
- java - 如何按可用于 Java 7 的频率对字符进行排序?
- spring - Spring Boot DTO/Payload 验证,带有额外的非必填字段
- loops - Fortran中循环退出后索引变量的值
- reactjs - 未找到 JSXBundle
- go - gobwas-ws clean conn 关闭
- plugins - Mercurial插件不可用?
- xamarin.forms - ImageCropper.Forms 抛出:“找不到方法
- javascript - 为什么 jQuery 不能更新事件中的输入值?
- elasticsearch - 在文件列表中查找每天的最低价格