我正在尝试使用 react-native init ABC --version 0.57.0 并且它有一个错误。尝试使用其他格式的init,但仍然不起作用。
最佳答案
如果有人需要安装 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"
}
}
关于react-native - 无法使用 React Native CLI 初始化版本低于 0.60.0 的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57230821/