Create-react-app: Fails to install on windows 10, whitespace in path issue?

Created on 19 Feb 2018  路  6Comments  路  Source: facebook/create-react-app

Is this a bug report?

yes

Did you try recovering your dependencies?

npm 5.60

Which terms did you search for in User Guide?

npx

Environment

  1. node -v: 9.5.0
  2. npm -v: 5.6.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven鈥檛 ejected):

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version (if relevant):

Steps to Reproduce

  1. npx create-react-app my-app


    1. 3.

Expected Behavior

The folder "my-app" is created and the create-react-app is installed in that folder

Actual Behavior


Failed to install create-react-app, looks like a problem with white-spaces in path, my user is "Ola Andersson" and the error message reports failure on "Andersson\".

PowerShell log:
```PS C:github> npx create-react-app my-app
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Andersson\AppDataRoamingnpm-cache_npx\12704" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ola Andersson\AppDataRoamingnpm-cache_logs\2018-02-19T09_09_57_341Z-debug.log
Install for prefix@latest failed with code 1
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Andersson\AppDataRoamingnpm-cache_npx\1696" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ola Andersson\AppDataRoamingnpm-cache_logs\2018-02-19T09_10_03_239Z-debug.log
Install for create-react-app@latest failed with code 1

**Npm error log:** 
```0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'prefix@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   'C:\\Users\\Ola',
1 verbose cli   'Andersson\\AppData\\Roaming\\npm-cache\\_npx\\19436',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 2ab654195912f881
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file:Andersson\AppData\Roaming\npm-cache\_npx\19436 Could not install from "Andersson\AppData\Roaming\npm-cache\_npx\19436" as it does not contain a package.json file.
8 http fetch GET 304 https://registry.npmjs.org/prefix 335ms (from cache)
9 silly pacote tag manifest for prefix@latest fetched in 458ms
10 verbose stack Error: ENOENT: no such file or directory, open 'C:\github\Andersson\AppData\Roaming\npm-cache\_npx\19436\package.json'
11 verbose cwd C:\github
12 verbose Windows_NT 10.0.16299
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "prefix@latest" "--global" "--prefix" "C:\\Users\\Ola" "Andersson\\AppData\\Roaming\\npm-cache\\_npx\\19436" "--loglevel" "error" "--json"
14 verbose node v9.5.0
15 verbose npm  v5.6.0
16 error code ENOLOCAL
17 error Could not install from "Andersson\AppData\Roaming\npm-cache\_npx\19436" as it does not contain a package.json file.
18 verbose exit [ 1, true ]

Reproducible Demo

Most helpful comment

The above error is due the white space contain in your username of PC. The command npx create-react-app doesn't work in this situation and shows error. I have fixed the error and created my first react app.
https://github.com/philson-philip/react-skills
Check the above link for solving the problem and creating your first app with react. Commands are detailed in the README.md file.

All 6 comments

Looks like the issue is with npx.

Closing as unactionable by us.

This is an issue with npx. Your computer name has a space in it. See this issue in the npx repo for more info. It is unresolved, unfortunately. I'd recommend npm install -g create-react-app to get around the npx issue.
after that run this command:- npx create-react-app my-app

The above error is due the white space contain in your username of PC. The command npx create-react-app doesn't work in this situation and shows error. I have fixed the error and created my first react app.
https://github.com/philson-philip/react-skills
Check the above link for solving the problem and creating your first app with react. Commands are detailed in the README.md file.

I had a similar error on Ubuntu WSL on Windows 10, and tried just dropping npx, so calling just

create-react-app tutorial-react

and it seems to work now

I should say that I'm using npx on WSL and not having any issues. So it definitely seems to be an npx issue sadly :/

To give yourself less headaches in future, you could rename your computer?

Was this page helpful?
0 / 5 - 0 ratings