Search code examples
xcodereact-nativereact-native-cli

React Native CLI version for Xcode 9.2


I had followed the instructions on installing React Native from the official website. After doing as instructed, when I run the code, I get a error and after some research I found out it is because I am still using a 2011 MAC BOOK PRO and the Xcode version I am using is Xcode 9.2 which is not really compatible with the current version of React Native.

I would like to use the old version of React Native. Which React Native version is compatible with Xcode 9.2 and which React Native CLI version should I be using?

I tried installing the old version using the CLI by:

react-native init Test --version 0.51

But I get the following error:

This will walk you through creating a new React Native project in /Users/bliss/Documents/Coder/ReactNative/Test Using yarn v1.3.2 Installing 0.51... yarn add v1.3.2 info No lockfile found. [1/4] 🔍 Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/0.51: Not found". info If you think this is a bug, please open a bug report with the information provided in "/Users/bliss/Documents/Coder/ReactNative/Test/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. { Error: Command failed: yarn add 0.51 --exact at checkExecSyncError (child_process.js:629:11) at execSync (child_process.js:666:13) at run (/usr/local/lib/node_modules/react-native-cli/index.js:294:5) at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3) at init (/usr/local/lib/node_modules/react-native-cli/index.js:200:5) at Object. (/usr/local/lib/node_modules/react-native-cli/index.js:153:7) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) status: 1, signal: null, output: [ null, null, null ], pid: 6231,
stdout: null, stderr: null } Command yarn add 0.51 --exact failed.


Solution

  • The format you are giving in the version is in the wrong way.

    As you can see in the docs it should be

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

    Instead of 0.51 try 0.51.0.

    You can also check this question where there is alot of answer and other ways of doing it.