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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 23 (4 by maintainers)
Commits related to this issue
- Fix monorepo workflow (#4273) <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily unde... — committed to software-mansion/react-native-reanimated by tomekzaw a year ago
- Fix monorepo workflow (#4273) <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily unde... — committed to software-mansion/react-native-reanimated by tomekzaw a year ago
- Fix monorepo workflow (#4273) <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily unde... — committed to wordpress-mobile/react-native-reanimated by tomekzaw a year ago
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
ornpm uninstall react-native
then retry it again
npx react-native init AwesomProject
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 leveli.e Documents
&Documents/Apps/Mobile
Check if you have npm installed
run
npm install
npx react-native init - also fails with same error
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