首页 > 解决方案 > 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"
  },


标签: reactjsreact-nativeweb-hostingshared-hosting

解决方案


推荐阅读