React Github Pages Deploy ERR_ABORTED 404 (Not Found)
Asked Answered
U

4

9

I'm trying to deploy my create-react-app here But I'm getting these error. static/css/1.e03ed13c.chunk.css net::ERR_ABORTED 404 (Not Found). I have no any chunk.css file. What is a problem? Can you help me?

My package.json

{
  "homepage": "http://ebrugulec.com/image-text-detection",
  "name": "image-text-detection",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "filepond": "^3.5.0",
    "filepond-plugin-image-preview": "^3.1.4",
    "react": "^16.6.3",
    "react-autosize-textarea": "^5.0.1",
    "react-dom": "^16.6.3",
    "react-dropzone": "^7.0.1",
    "react-filepond": "^5.0.0",
    "react-scripts": "2.1.1",
    "superagent": "^4.0.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "gh-pages": "^2.0.1"
  }
}
Unthrone answered 15/12, 2018 at 21:15 Comment(7)
medium.com/@_mariacheline/…Tub
Could you please share your package.json?Neurovascular
I guess, one thing you might be missing is correcting your homepage in package.json. Also, chunk.css is generated.Neurovascular
I edited my question and I added a package.json file. @sudobangbangUnthrone
did u resolve this issue? I have the same problemCult
I didn't solved corretly this problem. But I realized something. if i deploy github pages firstly, github pages not working. Hovewer if I send current pull request on github, after that i deployed gh-pages. It's working corretly. I don't know. Sometimes gh-pages not working very well. @CultUnthrone
I'm having the exact same problemJanssen
C
8

I was able to resolve the problem by adding Adding "homepage": "." to package.json.

Chaparro answered 1/9, 2020 at 12:42 Comment(0)
J
7

I solved this issue by adding


"homepage" : "https://myblog-url",

in 'package.json' file in my react-app project directory

xxx.chunk.js and xxx.chunk.css file is in 'build/static/' directory

and when I went to network tab of developer tools of chrome and saw the exact error messages,

I was able to find url my browser was going to access, and in my case, the url of my blog was different from what I meant to be.




Janssen answered 19/5, 2019 at 4:28 Comment(1)
Adding "homepage": "." to package.json worked for me.Blacksnake
M
3

If adding . to "homepage": "." in package.json not working then this answer will help you.

I have checked my developers console and my first indication was, where is this build folder which is throwing error.

enter image description here

Step 1: (optional, if your build folder is already committed, then skip this step) First commit your build folder, if that is not committed.

To commit build folder:

  • First remove the reference of build folder from your .gitignore
  • Then add your folder and commit

Sample: my folder path of build folder is covidresources -> build. (note: git add . is just to include other files as well, if any)

git add covidresources/build
git add . 
git commit -m "added build files"
git push

Just verify if your build files are now committed.

Step 2: Now, we will pick one file and compare the path of the file in repository and the path of the file in developers console (the file which was throwing error).

  • Initially I have "homepage": "." in package.json.
  • Pick any error from console, like in my case, I have picked the path of this file: 2.6770f89d.chunk.js from console
https://kushalseth.github.io/kushalseth/mycovid/blob/main/covidresources/static/js/2.6770f89d.chunk.js
  • Search the same file path in repository. enter image description here

  • Now compare the two paths: enter image description here

SOLUTION:

  • Replace, "homepage": "." with the path, something like this: (the screenshot of actual and file path will help to make this url. Just removed the name of user, and added repository name after github.com)
"homepage": "https://github.com/mycovid/"
  • Deploy and commit your files. Our main aim is to commit build/asset-manifest.json file.
npm run deploy
npm add .
npm commit -m "committing manifest"
npm push

Your manifest file should look like this: (repoitoryname/static).

It is important that your server manifest file is updated and It's also important to verify the path in manifest. We donot change anything manually in manifest. it gets updated automatically by npn run deploy and package should have correct homepage.

enter image description here

Refresh your page, and in networks of developers console, the success path will come like this:

https://kushalseth.github.io/mycovid/static/js/2.6770f89d.chunk.js

enter image description here

Misogyny answered 3/5, 2021 at 21:56 Comment(0)
M
0

Adding the below property in the package.json will solve this problem.

"homepage": "."

Monia answered 13/5, 2022 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.