I have a Windows computer from my college days that didn’t have create-React-App installed, just the Node environment. ** Version: Node -> 10.16.3, NPM -> 6.9.0. ** a few days ago, I tried to install React for it, but failed.

The installation process

NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app

An error

NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app: NPX create-react-app

npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\1452" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2020-02-14T14_46_10_318Z-debug.log
Install for create-react-app@latest failed with code 1
Copy the code

At this point, I was still confused, carefully checked the version information and command, found that there is no wrong, repeated several times after the same error. Files\nodejs\node_cache\_npx\1452 does not contain package.json file. However do not have what * use, za still do not understand……

To solve

Had to offer baidu dafa, a meal operation, took a lot of detours, but still let me find a big guy to write the solution, thank the big guy here.

The error is caused by a space in the path of node_cache. The error cannot be found in the path of node_cache.

npm config set prefix "E:\Program~1\nodejs\node_global"
npm config set cache "E:\Program~1\nodejs\node_cache"
Copy the code

Let’s reset the path to somewhere else, but not the same as the path above.

If you think it is helpful, please click “like”, thank you!