无法使用React Native CLI初始化版本低于0.60.0的项目

时间:2019-07-27 09:26:19

标签: react-native

我正在尝试使用react-native初始ABC-版本0.57.0,它有一个错误。尝试使用其他格式的init,但仍然无法正常工作。

3 个答案:

答案 0 :(得分:3)

如果有人需要安装0.59.x,请执行以下操作:

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 react-native@0.59.10...
yarn add v1.21.1
warning ../../package.json: No license field
info No lockfile found.
[1/4] ?  Resolving packages...
info Direct dependencies
└─ react-native@0.59.10
$ 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"
  }
}

答案 1 :(得分:0)

尝试重新安装react-native CLI

答案 2 :(得分:0)

react-native init abc NOT ABC 必须是小写字母