Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use React Native CLI to initialize project with version lower than 0.60.0

Tags:

react-native

I'm trying to use react-native init ABC --version 0.57.0 and it has an error. Tried to use other formats of init, but still doesn't work.

like image 391
beginnerlaravelvue Avatar asked Jul 27 '19 09:07

beginnerlaravelvue


People also ask

How do I install a specific version of react-native?

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.


2 Answers

If anybody needs to install 0.59.x do this:

mkdir rn59cli
cd rn59cli
npm init -f
npm install react-native-cli
node_modules/.bin/react-native init Rn59SampleApp --version 0.59.10
Using yarn v1.21.1
Installing [email protected]...
yarn add v1.21.1
warning ../../package.json: No license field
info No lockfile found.
[1/4] šŸ”  Resolving packages...
info Direct dependencies
ā””ā”€ [email protected]
$ cat Rn59SampleApp/package.json
{
  "name": "Rn59SampleApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.10"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "babel-jest": "^25.1.0",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.58.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}
like image 192
Gianfranco P. Avatar answered Sep 25 '22 13:09

Gianfranco P.


Try re-installing react-native CLI

like image 27
Kiran JD Avatar answered Sep 24 '22 13:09

Kiran JD