如何在我的托管服务器中部署React应用程序

时间:2019-02-18 13:20:40

标签: reactjs deployment react-router web-hosting package.json

我有一个普通的HTML网站,里面有一个按钮,用于链接应用程序。我在终端中使用npm run build,然后将build文件夹中的所有文件部署到public_html/projects/react中。问题是部署后,当我浏览到package.json文件中提供的路径时,它会显示空白页,但是该路径是正确的,因为我可以在浏览器标签栏中看到标题和徽标。

请帮忙,这是我第一次使用React,我不知道问题是否出在部署应用程序中,还是我必须在React应用程序中提供一些设置。

Package.json:

{
  "name": "movie_search",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://example.com/projects/react",
  "dependencies": {
    "animate.css": "^3.7.0",
    "axios": "^0.18.0",
    "bootstrap": "^4.3.1",
    "react": "^16.7.0",
    "react-bootstrap": "^1.0.0-beta.5",
    "react-dom": "^16.7.0",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^2.1.5",
    "react-scroll": "^1.7.11",
    "react-transition-group": "^2.5.3",
    "wow.js": "^1.2.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "eject": "react-scripts eject",
    "build": "react-scripts build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

0 个答案:

没有答案