Problem
I’ve been dabbling in React and recently discovered the amazing create-react-app
tool. Here’s a unique problem I ran into when using it, and my solution.
- In Visual Studio Team Services (VSTS), I created a new project called “My Project”. The space is important.
- VSTS will create a default git repository using the same name as the project.
- I pushed the React app to source control.
- The repo URL is
https://myaccount.visualstudio.com/_git/My%20App
(notice the encoded space), so cloning it will put it into aMy%20App
directory. - Run
npm start
- In terminal, you’ll see the error:
"Failed to decode param '/%PUBLIC_URL%/favicon.ico'
and 400 bad request errors in the developer console.
Solution
The solution is simple, but not immediatley obvious. The %
in the file path was breaking the build task searching for the %PUBLIC_URL%
tokens in index.html
.
My fix was to rename the project folder. I also renamed the repo to spare the rest of the devs on my team.