AnswerBun.com

react start cannot find files in public folder

Stack Overflow Asked by Minh Triet on November 5, 2020

When running npm start, my code shows a blank page, without favicon either, and the browse console shows

Loading failed for the <script> with source “http://localhost:3000/short_text_understanding/static/js/bundle.js”. bundle.js:23:1
Loading failed for the <script> with source “http://localhost:3000/short_text_understanding/static/js/0.chunk.js”. bundle.js:23:1
Loading failed for the <script> with source “http://localhost:3000/short_text_understanding/static/js/main.chunk.js”. bundle.js:23:1

If it helps debugging, my code works previously, but after npm audit, my package.json changed

-   "react-scripts": "3.4.1"
+   "react-scripts": "^3.4.3"

My package.json

{
  "name": "short_text_understand",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "^3.4.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
    "eject": "react-scripts eject",
    "lint": "eslint .",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "proxy": "http://localhost:5000",
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "eslint-config-airbnb": "^18.2.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-prettier": "^3.1.4",
    "gh-pages": "^3.1.0",
    "prettier": "^2.0.5"
  }
}

Structure of source is

.
├── Dockerfile
├── LICENSE
├── README.md
├── docker-compose.yml
├── nginx
│   ├── Dockerfile
│   └── nginx.conf
├── package-lock.json
├── package.json
├── public
│   ├── android-chrome-192x192.png
│   ├── android-chrome-512x512.png
│   ├── apple-touch-icon.png
│   ├── favicon-16x16.png
│   ├── favicon-32x32.png
│   ├── favicon.ico
│   ├── index.html
│   ├── manifest.json
│   ├── robots.txt
│   └── site.webmanifest
├── src
│   ├── index.js
│   ├── normalize.css
│   ├── skeleton.css
│   └── style.css
└── src_python
    ├── Dockerfile
    ├── __pycache__

What I do not understand is why the bundle.js disappears, and why my favicon is not loaded, even though I did not move the public folder, and things worked before.

I am totally new in this, please tell if you need any other information

2 Answers

The reason was because I used ublock (not ublock origin). Note that this is not the of the shelf version, as I selected all the black list

Correct answer by Minh Triet on November 5, 2020

If you are using create react app to generate application then follow the instructions given in this link

https://create-react-app.dev/docs/using-the-public-folder/

Answered by Shamim Shams on November 5, 2020

Add your own answers!

Related Questions

Animation to play once per session

0  Asked on January 15, 2021 by alejandro-vargas

       

postgres random text in jsonb column

2  Asked on January 15, 2021 by ed1t

         

How to make TestNG print detail message about the failure

2  Asked on January 15, 2021 by gelin-luo

 

Strange igraph behaviour, generating duplicate vertices

1  Asked on January 15, 2021 by simon-mills

   

C++ printing float as nan

1  Asked on January 14, 2021 by acarter

     

Webclient isn’t dowloading everything from URL c#

1  Asked on January 14, 2021 by shynex

       

How to change the entire div content on button click

2  Asked on January 14, 2021 by liel-barouch

   

Sorting and paging nested documents

2  Asked on January 14, 2021 by taras-kohut

 

How to adjust for loop so that it prints list only once?

1  Asked on January 14, 2021 by benito-cano

         

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP