Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npx react-native init error does not contain a package.json file in appdata folder

when I use regular npm or npx commands like

npm -version

or

npx -version

there is no error, but for my react native project when I use

npx react-native init testApp

it shows this error:

does not contain a package.json file in appdata folder

How can I fix this error?

like image 943
aygin Avatar asked Dec 19 '19 07:12

aygin


1 Answers

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 try:

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

be careful for space character in the pc name you should use "~1" instead

good luck

like image 84
kamrankamranifard Avatar answered Oct 05 '22 18:10

kamrankamranifard