lundi 1 juillet 2019

ReactJS deployment to github pages: manifest.json 404 (Not Found)

I used create-react-app to build a ReactJS app. To publish it to Github pages, I've followed the instructions carefully.

when doing

npm run deploy 

deployment seems succesful. However, when I go to my github page, nothing is displayed and when I check my console I get this error from manifest.json:1:

GET https://marktension.github.io/MarkTension/portfolio_web/manifest.json 404 (Not Found)
Manifest: Line: 1, column: 1, Unexpected token.              

interestingly, Safari gives a different error output:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (main.01c78356.chunk.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (2.1ccdc38f.chunk.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (main.62195bda.chunk.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (favicon.ico, line 0)

My package.json looks like this:

{
  "name": "portfolio_react",
  "homepage": "https://github.com/MarkTension/portfolio_web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "animated-scroll-to": "^1.2.2",
    "gh-pages": "^2.0.1",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "3.0.1",
    "react-stickynode": "^2.1.1",
    "rebass": "^3.1.1",
    "require": "^2.4.20",
    "simple-flexbox": "^2.0.0"
  },
  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "file-loader": "^4.0.0",
    "image-webpack-loader": "^5.0.0"
  }
}

When going to Chrome Dev tools I found that manifest.json response header Content-Type is text/html, not JSON, so maybe that's what's wrong? I'm quite new to web deployment, so any advice would be rather helpful.

Thanks!




Aucun commentaire:

Enregistrer un commentaire