question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native-cli --version doesn't work

See original GitHub issue

Description

I was unable to choose the react native version using the cli when I create new project using npx react-native init MyProject --template react-native-template-typescript --version 0.65.1
-> I get the version 0.66.0 (that I can’t use for now because of use of some libraries that are not compatible yet)

React Native version:

npx react-native --version
6.1.0
npx react-native info
System:
    OS: macOS 11.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 74.99 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.6 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
    Watchman: 2021.10.04.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 29, 30, 31
      Build Tools: 29.0.2, 30.0.2, 31.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7678000
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.66.0 => 0.66.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Run the comand above.

Expected Results

Use react native with the good version.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
uniquejavacommented, Apr 27, 2022

Another pitfall(surprising moment) from RN, for those who need a quick solution…

Change this

$ npx react-native init DetoxHello \
--template react-native-template-typescript \
--version 0.67.2 \
--skip-install

to this

$ npx react-native init DetoxHello \
--template react-native-template-typescript@6.9.4 \
--skip-instal

You can get the correct version number from here: https://github.com/react-native-community/react-native-template-typescript#usage-with-older-versions-of-react-native

So why I need to use a previous version, becoz I used detox as e2e test tool(recommended by RN document), and find that they don’t support RN 0.68.

1reaction
jpaascommented, Jan 29, 2022

If I don’t use the typescript template option, it works correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - React Native
Try downgrading your Gradle version to 1.2.3 in android/build.gradle . react-native init hangs​. If you run into issues where running npx react- ...
Read more >
Cannot use React Native CLI to initialize project with version ...
Cannot use React Native CLI to initialize project with version lower than 0.60.0 ... I'm trying to use react-native init ABC --version 0.57.0...
Read more >
Troubleshooting | React Navigation
Before troubleshooting an issue, make sure that you have upgraded to the latest available versions of the packages. You can install the latest...
Read more >
"React Native version mismatch" errors - Expo Documentation
If this is a managed workflow project, you should make sure your react-native version is correct. Run expo-cli doctor will show a warning...
Read more >
Create a New React App
Razzle is a server-rendering framework that doesn't require any configuration, but offers more flexibility than Next.js. Creating a Toolchain from Scratch. A ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found