npx react-native init AwesomeProject error enolocal
Asked Answered
D

6

5

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?

Dresser answered 8/7, 2020 at 8:37 Comment(0)
D
3

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

Dominican answered 8/7, 2020 at 8:51 Comment(0)
O
3

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

Oshinski answered 12/8, 2022 at 11:26 Comment(1)
This is not truly a fix. It is simply using global react-native package instead of the one provided by npx.Haymow
N
2

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
Nisi answered 21/1, 2021 at 13:6 Comment(0)
D
0

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

Dresser answered 8/7, 2020 at 12:48 Comment(0)
T
0

For MAC users

For the latest version, npm won't let you clear the cache. So to fix this issue, run;

npm cache verify

If throwing an error run this command (will be shown in the error too);

sudo chown -R 501:20 "/Users/username/.npm"

After that, test whether the cache is verified or not by running the first command again. If it worked, you are good to go. Run the react native cli command to create the new project and that should work fine.

npx react-native@latest init yourproject
Towhee answered 17/4, 2023 at 13:11 Comment(0)
H
0

init has deprecated. However you can still use :

npx @react-native-community/cli@latest init newapp

source : https://reactnative.dev/docs/getting-started

Hoodlum answered 27/10, 2024 at 19:59 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.