Create-react-app: npm install/start not working properly when path contains '%'?

Created on 1 Jun 2017  路  8Comments  路  Source: facebook/create-react-app

Can you reproduce the problem with latest npm?

Yes

Description

I deleted the node_modules of my project and then proceeded to run npm install (to check if it was ready for version control), the npm install everything until there. When I run npm start, the public/index.html is loaded but appears that the src/index.js is not evaluated, I've checked this with come console logs. After a a while trying to understand what was going on I noticed that a part of my project path is called 'XXX%20-%20XX%20-%20XXX%20XXXX%20-%20XX' with this suspicion I have changed the name of the folder and now everyhing is working ok

Expected behavior

npm start would start my app as normal with src/index.js being evaluated

Actual behavior

npm start appears to be not loading src/index.js when the project file path contains '%'

Environment

  1. npm ls react-scripts (if you haven鈥檛 ejected):
    `-- [email protected]
  2. node -v:
    6.9..5
  3. npm -v:
    5.0.0

Then, specify:

  1. Operating system:
    Windows 10

  2. Browser and version:
    Firefox and Chrome (latest)

bug underlying tools

All 8 comments

It's possible and might be a Webpack bug. Thanks for reporting, we'll report this upstream.

Can somebody verify this is reproducible?

Just ran into this, having a % in a path throws this error in the browser:

URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at getFilenameFromUrl (D:\%_newfolder\test2\node_modules\webpack-dev-middleware\lib\GetFilenameFromUrl.js:32:9)
    at webpackDevMiddleware (D:\%_newfolder\test2\node_modules\webpack-dev-middleware\middleware.js:39:18)
    at Layer.handle [as handle_request] (D:\%_newfolder\test2\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (D:\%_newfolder\test2\node_modules\express\lib\router\index.js:317:13)
    at D:\%_newfolder\test2\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (D:\%_newfolder\test2\node_modules\express\lib\router\index.js:335:12)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\index.js:275:10)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:127:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)
    at next (D:\%_newfolder\test2\node_modules\express\lib\router\route.js:131:14)

(and decodeURIComponent throws because % isn't a valid character in a URI).

Would you like to send a fix to Webpack?

Ooh nice. Let us know when it makes it into a stable release!

Shipped in [email protected] 馃巻

Closing as fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wereHamster picture wereHamster  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

barcher picture barcher  路  3Comments

ap13p picture ap13p  路  3Comments