React Native init specific version

76,537

Solution 1

This should do the trick:

$ react-native init newproject --version X.XX.X

Solution 2

$ react-native init projectname --version 0.56.0 

please check this guide https://reactnative.dev/docs/environment-setup enter image description here

Solution 3

Version and Template

Currently, I'm having problems with the 0.60.0 version so for doing this with version and typescript it goes like this:

react-native init ProjectName --version="0.59.9" --template="typescript"

This has 2 unwanted side effects:

  1. devDependencies will be the latest but the dependencies will be the chosen, this will work anyway after...
  2. You will get a react-native/libraries/NewAppScreen error, go to App.tsx and replace all of that for something simple like a <View style={{flex:1,backgroundColor:'orange'}}> so you can see it running

Solution 4

You can do it like this:

react-native init YourProjectName --version X.XX.X

enter image description here

Solution 5

This seems to work.

react-native init --version="0.36.0" MyNewApp

Check the comment on this link :).

Share:
76,537

Related videos on Youtube

Hasen
Author by

Hasen

Updated on June 15, 2022

Comments

  • Hasen
    Hasen less than a minute

    I upgraded my latest project to React Native 0.19 and instantly the video no longer works. How can I create a new project with a specific version? I want to init a new project at version 0.18.1. I did some google searches but couldn't find anything about this.

    $ react-native init newproject --verbose
    

    I'm guessing I need to add the word @18.1 in there somewhere but can't get that to work.

    • Nader Dabit
      Nader Dabit over 6 years
      You could use the initialized project, delete the node_modules, then go into the package.json file and specify the version you want, and run npm insall again.
    • Bataleon
      Bataleon about 3 years
      I would not recommend this approach as there could be changes to the native Xcode and Android projects which won't get applied if you only change the React Native version in package.json
  • Bataleon
    Bataleon almost 3 years
    @Polygon I agreed but it was added more than 1.5 years after my answer so I guess that's why it hasn't received as many upvotes.
  • Polygon
    Polygon over 2 years
    This works with new versions now, and this is the standard method.
  • Rayan Ral
    Rayan Ral almost 2 years
    What does this add to the already existing answers?