react-native: npx react-native info and npx react-native init fails with error

Description

npx react-native fails with error : - Failed to load configuration of your project.

Version

not known, trying the latest

Output of npx react-native info

error Failed to load configuration of your project.

Steps to reproduce

npx react-native info

Snack, code example, screenshot, or link to a repository

Screenshot 2022-08-17 at 11 52 50 PM Screenshot 2022-08-17 at 11 53 28 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 23 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I also ran into this (very nondescript) error message, and for me it was simply caused by accidentally running the npx command inside a directory that already contained a package.json file.

First, remove the locally installed react-native

npm uninstall -g react-native or npm uninstall react-native

then retry it again

npx react-native init AwesomProject

I also ran into this (very nondescript) error message, and for me it was simply caused by accidentally running the npx command inside a directory that already contained a package.json file.

this also worked for me, even though the package.json was not directly in the file I was attempting to create the app in, but rather on a global level i.e Documents & Documents/Apps/Mobile

Check if you have npm installed

run npm install

npx react-native init - also fails with same error

I also ran into this (very nondescript) error message, and for me it was simply caused by accidentally running the npx command inside a directory that already contained a package.json file.

this also worked for me, even though the package.json was not directly in the file I was creating the app line, but rather on a global level i.e Documents & Documents/Apps/Mobile

Thank you, had the same issue, had a package.json in the root folder 😮‍💨

Same, incredible. 😮‍

You’re most likely having some globally installed version of react-native or the CLI that you’ll have to remove. Instructions on how to do them are here:

https://github.com/facebook/react-native/issues/34055#issuecomment-1165887713