Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx react-native init AwesomeProject fails #34968

Closed
princefishthrower opened this issue Oct 13, 2022 · 2 comments
Closed

npx react-native init AwesomeProject fails #34968

princefishthrower opened this issue Oct 13, 2022 · 2 comments

Comments

@princefishthrower
Copy link

princefishthrower commented Oct 13, 2022

Description

As the title states, I can't issue npx react-native init AwesomeProject, here's my console output:

npx react-native init AwesomeProject


Need to install the following packages:
  react-native@0.70.3
Ok to proceed? (y) y
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native@0.68.2
npm ERR! node_modules/react-native
npm ERR!   peer react-native@"*" from @react-native-community/cli@7.0.3
npm ERR!   node_modules/@react-native-community/cli
npm ERR!     @react-native-community/cli@"^7.0.3" from react-native@0.68.2
npm ERR!   react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.1.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.1.0" from react-native@0.70.3
npm ERR!   node_modules/react-native
npm ERR!     react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/chris/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chris/.npm/_logs/2022-10-13T11_03_12_994Z-debug-0.log

Version

70.3

Output of npx react-native info

Can't even issue this one either:

npx react-native info
Need to install the following packages:
  react-native@0.70.3
Ok to proceed? (y) y
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native@0.68.2
npm ERR! node_modules/react-native
npm ERR!   peer react-native@"*" from @react-native-community/cli@7.0.3
npm ERR!   node_modules/@react-native-community/cli
npm ERR!     @react-native-community/cli@"^7.0.3" from react-native@0.68.2
npm ERR!   react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.1.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.1.0" from react-native@0.70.3
npm ERR!   node_modules/react-native
npm ERR!     react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/chris/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chris/.npm/_logs/2022-10-13T11_03_39_253Z-debug-0.log

Steps to reproduce

  1. Issue npx react-native info or npx react-native init AwesomeProject in a terminal

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

Not applicable to a snack since it s a CLI tool, so here's the screenshot of my terminal output:

Screen Shot 2022-10-13 at 13 04 43

@josephk96
Copy link

Hi @princefishthrower , I ran into a similar issue just a few hours ago. Can you try the following and see if it works?

npm uninstall -g react-native-cli && npm install -g react-native-cli && npm install -g react-native && npx react-native init AwesomeProject

I found this SO thread - https://stackoverflow.com/questions/72768245/typeerror-cli-init-is-not-a-function-for-react-native and it worked for me

@cortinico
Copy link
Contributor

This is a duplicate of #34051 which is already solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants