React Native 环境
Posted keeyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native 环境相关的知识,希望对你有一定的参考价值。
1. npm install -g yarn react-native-cli=>Yarn是 Facebook 提供的替代 npm 的工具,可以加速 node 模块的下载
or yarn global add create-react-native-app
2. or npm install -g react-native-cli => base cli
https://www.npmjs.com/package/react-native-cli
3. npm install -g create-react-native-app =>better integrated with exp, 跳过了配置 Android 和 iOS 编译环境的步骤
4. npm i -g exp
https://www.npmjs.com/package/exp
npm install expo-cli --global
expo init my-new-project
cd my-new-project
expo start
5. windows Expo - XDEclient:
doc: https://docs.expo.io/versions/latest/guides/building-standalone-apps.html
install: https://docs.expo.io/versions/v29.0.0/introduction/installation
source code: https://github.com/expo/expo
tools: https://expo.io/ => login to see your c/s expo projects, b/s snack projects
6. npm config set registry https://registry.npmjs.org => try it, slower but better than taobao.org when have error run npm i
7. npm install -g cnpm --registry=https://registry.npm.taobao.org
Fettaching lodash Error: connect ECONNREFUSED 221.179.46.190:443=> swith to taobao.org
8. npm i -g lodash --registry=https://registry.npm.taobao.org
9. npm i -g lodash.assign --registry=https://registry.npm.taobao.org
10. npm i -g [email protected]^4.6.0
11. npm i –g [email protected]^4.5.0
12. npm i -g [email protected]
13. create-react-native-app my-app
14. App.js support Monitoring file changes by expo tools, building is very slowly in ios expo
15. https://snack.expo.io/ =>another: online b/s create demo and sync to app running by expo app. Snack lets you to run complete React Native projects in the browser. No download required.
16. As of March 29, 2018 , the Expo client on iOS can no longer scan QR codes. Read more.. => then Ios use default ios camera to scan and click it.
17. expor ios similator https://itunes.apple.com/app/apple-store/id982107779
18. expor ios andorid similator: avd android aslo can running.
19 . buiding spend 3 mins in iphone6s and 4 mins minsandroid similator
20. 使用app.json进行配置 => reference https://www.cnblogs.com/gdsblog/p/8540353.html
21. app.json =>https://docs.expo.io/versions/latest/guides/building-standalone-apps.html
{
"expo": {
"name": "Your App Name",
"icon": "./path/to/your/app-icon.png",
"version": "1.0.0",
"slug": "your-app-slug",
"sdkVersion": "XX.0.0",
"ios": {
"bundleIdentifier": "com.yourcompany.yourappname"
},
"android": {
"package": "com.yourcompany.yourappname"
}
}
}
以上是关于React Native 环境的主要内容,如果未能解决你的问题,请参考以下文章
React Native开发 - 搭建React Native开发环境