'npx create-react-app' error on Windows 10

 I am creating a new React app and get the following error.

npm ERR! Could not install from "Smith\AppData\Roaming\npm-cache\_npx\17420" 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\John Smith\AppData\Roaming\npm-cache\_logs\2021-10-13T22_04_13_865Z-debug.log

This is because npx doesn't handle space in the user directory properly. Use the following command to get the short name of the user directory.

dir C:\Users /x

Then update the cache path.

npm config set cache "C:\Users\JOHNSM~1\AppData\Roaming\npm-cache" --global

See this post for other solutions.

Comments

Popular posts from this blog

Viewing test results and artifacts captured with 'Test & Feedback' in Azure DevOps

Changing default language in Visual Studio

The Web Development Puzzle