Getting blank page After uploading the build code into cPanle

89 Views Asked by At

I am trying to deploy the react code on cPanel and I refer to this link but I am getting a blank page.

Any suggestion on how to solve this?

I have the below code in package.json

{
  "name": "New",
  "homepage": "https://example.com/new/",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.1.1",
    "@testing-library/user-event": "^13.5.0",
    "bootstrap": "^5.1.3",
    "jquery": "^3.6.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^2.1.3",
    "react-scroll": "^1.8.7",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
1

There are 1 best solutions below

4
On

I'm not sure where you're uploading the build but what you're showing isn't the build. The build doesn't require a package.json. If I understand correctly - what you need to do is go to you local folder where the project is and run:

npm run build

It'll create a folder called 'build', take all the files from this folder (you'll see the index.html there) and upload it to you cPanel.