facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.71k stars 26.85k forks source link

Bug: URIError: Failed to decode param '//%PUBLIC_URL%/favicon.ico' #12283

Open kouayip opened 2 years ago

kouayip commented 2 years ago

I get a console error when I add '//' to the end of my address

React version: 17.0.2

Steps To Reproduce

  1. add '//' to the end of the url

Adress: http://localhost:3000//

Code console error:

GET http://localhost:3000//%PUBLIC_URL%/favicon.ico 400 (Bad Request)

manifest.json:1 GET http://localhost:3000//%PUBLIC_URL%/manifest.json 400 (Bad Request)

manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.

kouayip commented 2 years ago

the error is only displayed in developer mode

await-ovo commented 2 years ago

@gaearon Hey, I have tried other tools like Docusaurus, Vue CLI and all have the same problem, not sure if this is a bug or not.

The reason for the error is that accessing // returns index.htmlin the public directory. Setting webpack-dev-server's static.staticOptions.index to false should avoid this problem.

Wondering if it's possible to set this in react-scripts by default? thx

redpredator8 commented 1 year ago

Fix: if you have github, revert to the last change you did / unistall recent libraries

I updated my mac and this started happening, was killing my brain tbh. Im pretty sure it was bc i installed firebase tools and that messed up something because i updated my mac and maybe smth didnt save by mac time-machine so it was throwing a weird hidden syntax error that was preventing the app to be displayed. I tried fixing all the errors like the guys up top are saying fixing the links etc but brand new shit was popping up and I was like nahh. no way i have to recode Node to fix this shit.

Options: Revert to previous version / uninstall recent installed libraries / Create a new react app and just copy your src folder to the new app

leave a thubs up: )