-3

React project build success npm run build. After i run build/index.html file . Its shows nothing . in console i have error like Access to internal resource at 'file:///D:/siva/web/build/manifest.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

enter image description here

i tried npm i live-server and XAMPP. when i try live server or xampp the error is gone but the page still white.

enter image description here

my package.json

{
  "name": "web",
  "version": "0.1.0",
  "private": false,
  "proxy" : "http://localhost:5000",
  "homepage": "./",
  "dependencies": {
    "@chakra-ui/icons": "^1.1.7",
    "@chakra-ui/react": "^1.8.8",
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@fortawesome/react-fontawesome": "^0.1.18",
    "@testing-library/jest-dom": "^5.16.3",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "access-control": "^1.0.1",
    "animate.css": "^4.1.1",
    "bootstrap": "^5.1.3",
    "framer-motion": "^6.2.9",
    "http": "^0.0.1-security",
    "http-server": "^14.1.0",
    "jquery": "^3.6.0",
    "mdb-react-ui-kit": "^3.0.0",
    "otp-input-react": "^0.3.0",
    "prop-types": "^15.8.1",
    "rc-input-number": "^7.3.4",
    "react": "^18.0.0",
    "react-animations": "^1.0.0",
    "react-bootstrap": "^2.2.3",
    "react-bootstrap-tabs": "^2.0.0",
    "react-countdown-circle-timer": "^3.0.9",
    "react-crude-animated-tick": "^1.0.2",
    "react-date-picker": "^8.4.0",
    "react-dom": "^18.0.0",
    "react-icons": "^4.3.1",
    "react-id-swiper": "^4.0.0",
    "react-input-number": "^5.0.19",
    "react-items-carousel": "^2.8.0",
    "react-multi-carousel": "^2.8.0",
    "react-native-counters": "^1.2.0",
    "react-native-numeric-input": "^1.9.1",
    "react-native-step-indicator": "^1.0.3",
    "react-native-web": "^0.17.7",
    "react-numeric-input": "^2.2.3",
    "react-otp-input": "^2.4.0",
    "react-popupbox": "^2.0.9",
    "react-resize-detector": "^7.0.0",
    "react-responsive-modal": "^6.2.0",
    "react-responsive-pinch-zoom-pan": "^0.3.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.0",
    "react-simple-image-slider": "^2.4.1",
    "react-slick": "^0.28.1",
    "react-slideshow-image": "^3.7.3",
    "react-spinners": "^0.11.0",
    "reactstrap": "^9.0.2",
    "sass": "^1.49.11",
    "slick-carousel": "^1.8.1",
    "swiper": "^5.2.0",
    "xmlhttprequest": "^1.8.0"
  },
  "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"
    ]
  },
  "devDependencies": {
    "node-sass": "^7.0.1",
    "sass-loader": "^12.6.0",
    "web-vitals": "^2.1.4"
  }
}

my index.js

Siva_Stu
  • 27
  • 8
  • See the docs: [npm run build creates a build directory with a production build of your app. **Set up your favorite HTTP server**…](https://create-react-app.dev/docs/deployment) – Quentin May 05 '22 at 11:22
  • thank you @Quentin . i solved the problem . first i install `npm install --global http-server` then i run `http-server -c-1` comment in **build** folder . – Siva_Stu May 06 '22 at 10:31

0 Answers0