npx react-native init AwesomeProject error enolocal

Viewed 4269

i got an error while trying to create react native app using npx npx

react-native init AwesomeProject

like the docs said. But i got an error messages

npm ERR! code ENOLOCAL npm ERR! Could not install from "Indigo\AppData\Roaming\npm-cache_npx\3192" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: C:\Users\Durio Indigo\AppData\Roaming\npm-cache_logs\2020-07-08T08_20_54_191Z-debug.log Install for react-native@latest failed with code 1

i know it's not from the npx because i tried to create react app with npx and it works. Am I the only one who had this?

4 Answers

This is an issue in node which is caused by white space in user name between first-name and last-name in windows.

run the following command after replacing firstname with your windows user firstname in command prompt with administrator access

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

I had you try npm cache clear and if using windows you can run command npx react-native init AwesomeProject in Command promt using Run as Administrator

we should check the android SDK path on environment variable. Make sure there is no white space on the SDK path and platform-tools path

I have faced the same issue, do nothing just a quick fix.

first, run the command npm i react-native@latest -g then create your project with your command i.e npx react-native init myProject

Related