Reputation: 89
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?
Upvotes: 7
Views: 7225
Reputation: 11
This is because of the space in your computer's name, and besides working around your computer's namespace, you can also try installing the create-react-app globally as npm i -g create-react-app
and then run your npx create-react-app your-app-name
command again, this solved it for me!
Upvotes: 1
Reputation: 1
Change cache folder.
npm config set cache C:\tmp\nodejs\npm-cache --global
Upvotes: 0
Reputation: 618
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
Upvotes: 29