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.84k forks source link

Unable to start new cra; crashes with URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico' #4150

Closed RikuVan closed 6 years ago

RikuVan commented 6 years ago

Is this a bug report?

Yes

Environment

  1. node v8.9.1
  2. npm 5.7.1
  3. yarn 1.5.1
  4. react-scripts 2.13.0

Then, specify:

  1. Operating system: Mac OS High Sierra
  2. Browser and version (if relevant): Chrome 64.0.3282

Steps to Reproduce

(Write your steps here:)

  1. Clone Java backend built with springboot and maven from vsts
  2. cd into src/main
  3. create-react-app client --scripts-version=react-scripts-ts OR create-react-app client
  4. cd client && npm start (also tried yarn start)
  5. results in error Tried more than 10 times and also on two different macs (both mac OS High Sierra). Have tried clearing npm and yarn caches as well as reinstalling create react app. I have successfully built cra apps recently (in the last week) on both computers. The first time I created a project it seemed to work this morning but then I removed the app after install antd library and having some issues. After that I never got a newly installed create-react-app to work. I do not have this issue trying to build outside of the java project.

Expected Behavior

To build and render starter page

Actual Behavior

Fails to build with error below:

URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico' at decodeURIComponent () at decode_param (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/layer.js:172:12) at Layer.match (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/layer.js:123:27) at matchLayer (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:574:18) at next (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:220:15) at expressInit (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:317:13) at /Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:335:12) at next (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:275:10) at query (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/middleware/query.js:45:5) at Layer.handle [as handle_request] (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:317:13) at /Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/Users/richard.vancamp/code/repos/palkkatuki%20katre/client/node_modules/express/lib/router/index.js:335:12)

Sometimes I only got the Failed to decode param error and other times I also got a Typescript error: subsequent property declarations must have a type. Property 'a' of type...'followed by the decode aram error.

RikuVan commented 6 years ago

ok i figured out it is the percent encoded space here in the path palkkatuki%20katre that is breaking things. presuming I can't change the project name folder names at this point, is there any way to get around this issue?

RikuVan commented 6 years ago

Well I managed to get our team to rename the project in VSTS, so my issue is resolved. A warning to future developers using Visual Studio Team Services--don't put spaces in your project/repo names!

pietrocmcosta commented 6 years ago

had basically the same issue. Really appreciate the tip.

For anyone having similar issues to these when starting a react project: URIError: Failed to decode param

I recommend checking the entire path of the cloned folder for spaces , and if possible remove them,

That worked for me.