DEV Community

Krixnaas
Krixnaas

Posted on

npx create-react-app myapp error "\AppData\Roaming\npm-cache\_npx\19748" does not contain a package.json file in appdata folder

this error occurs usually when name of the PC contain a space like
mycomputer name

you should fix this by redefine your npm cache root There is a simple workaround to fix this problem. 8.3 DOS path format should be used. Open command prompt in administration mode then cd to C:\Users and run this command :
C:\Users>dir /x

and find the short path for your desired directory i.e. username let us say it is MYCOMP~1 (it's not always MYCOMP~1 ) try:
npm config set cache "C:\Users\MYCOMP~1\AppData\Roaming\npm-cache" --global

be careful for space character in the pc name you should use the one you got from command prompt instead and now use:
npx create-react-app myapp

Top comments (0)