摘要:安装此工具可以提高开发时的性能可以快速捕捉文件的变化从而实现实时刷新是一个静态的类型检查工具,这一语法并不属于标准,只是自家的代码规范。
安装转载请注明出处:http://www.wangxinarhat.com/2016/05/21/2016-05-21-react-native1/
摸索React Native有一段时间了,尝试在Windows下和linux下搭建开发环境,踩过的坑还是会忘,在此记录
nodejs
sudo apt-get install -y build-essential curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - sudo apt-get install -y nodejs sudo ln -s /usr/bin/nodejs /usr/bin/node
React Native命令工具
npm install -g react-native-cli
Watchman
Watchman是由Facebook提供的监视文件系统变更的工具。安装此工具可以提高开发时的性能(packager可以快速捕捉文件的变化从而实现实时刷新)
git clone https://github.com/facebook/watchman.git cd watchman git checkout v4.5.0 ./autogen.sh ./configure make sudo make install
Flow
Flow是一个静态的JS类型检查工具,这一语法并不属于ES标准,只是Facebook自家的代码规范。
npm install -g flow-bin配置
将ANDROID_HOME环境变量指向Android SDK的路径,ANDROID_NDK指向NDK目录
具体的做法是把下面的命令加入到~/.bashrc、~/.bash_profile文件中
export ANDROID_HOME=~/Android/Sdk
export ANDROID_NDK=~/Android/android-ndk-r10e
使用下列命令使其立即生效(否则重启后才生效):
source ./bash_profile
初始化一个React Native的Hello World项目并运行
react-native init HelloReact cd HelloReact react-native run-android
正常的话这是该有一个这样的界面
修改下index.android.js文件,手机端reload js,体验React Native
运行react-native run-android后手机出现Could not connect to development server
如下图:
查看github找到一个issue,解决方法是:
A common issue is that the packager is not started automatically when you run react-native run-android. You can start it manually using:
就是说运行react-native run-android,Packger可能不会自动运行,需手动启动它
react-native start
watchman issue : Poison: inotify_add_watch
出现以下错误
ERROR A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1466189741: inotify-add-watch(/home/wangxinarhat/ReactProjects/HelloReact/node_modules/react-native/node_modules/fbjs-scripts/node_modules/babel/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/braces/node_modules) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch {"watchmanResponse":{"version":"4.1.0","error":"A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1466189741: inotify-add-watch(/home/wangxinarhat/ReactProjects/HelloReact/node_modules/react-native/node_modules/fbjs-scripts/node_modules/babel/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/braces/node_modules) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch "}} Error: A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1466189741: inotify-add-watch(/home/wangxinarhat/ReactProjects/HelloReact/node_modules/react-native/node_modules/fbjs-scripts/node_modules/babel/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/braces/node_modules) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch at ChildProcess.(/home/wangxinarhat/ReactProjects/HelloReact/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:206:21) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:827:16) at Socket. (internal/child_process.js:319:11) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at Pipe._onclose (net.js:477:12)
因为inotify默认内核参数值太小,修改之:
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches watchman shutdown-server
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/12905.html
摘要:说实话现在连要重视哪些监控指标都不知道,但在中文介绍中,就安装这一块,踩的坑实在好多,所以有必要写篇文章记一下。这篇文章主要包括如何搭一个虚拟的服务器和相关配置按照官方的中文介绍安装,会踩到哪些坑。虚拟机选择的是。 收到新的任务研究一下 open-falcon 监控公司的服务器指标玩玩。说实话现在连要重视哪些监控指标都不知道,但在open-falcon 中文介绍 中,就安装这一块,踩的...
摘要:说实话现在连要重视哪些监控指标都不知道,但在中文介绍中,就安装这一块,踩的坑实在好多,所以有必要写篇文章记一下。这篇文章主要包括如何搭一个虚拟的服务器和相关配置按照官方的中文介绍安装,会踩到哪些坑。虚拟机选择的是。 收到新的任务研究一下 open-falcon 监控公司的服务器指标玩玩。说实话现在连要重视哪些监控指标都不知道,但在open-falcon 中文介绍 中,就安装这一块,踩的...
摘要:简介操作系统网页服务器数据库管理系统脚本语言注以下开始进行的是分步安装,如果你想一步安装请跳过,拉到页面底部,当然你得首先安装好自己的系统安装服务器如果你自己装过虚拟机或者有更好的安装技巧可跳过,这只是博主自己安装的方法此安装方式操作的是下 LAMP简介 L:Linux操作系统A:Apache网页服务器M:Mysql数据库管理系统P:Php脚本语言 注:以下开始进行的是分步安装,如果...
摘要:简介操作系统网页服务器数据库管理系统脚本语言注以下开始进行的是分步安装,如果你想一步安装请跳过,拉到页面底部,当然你得首先安装好自己的系统安装服务器如果你自己装过虚拟机或者有更好的安装技巧可跳过,这只是博主自己安装的方法此安装方式操作的是下 LAMP简介 L:Linux操作系统A:Apache网页服务器M:Mysql数据库管理系统P:Php脚本语言 注:以下开始进行的是分步安装,如果...
摘要:简介操作系统网页服务器数据库管理系统脚本语言注以下开始进行的是分步安装,如果你想一步安装请跳过,拉到页面底部,当然你得首先安装好自己的系统安装服务器如果你自己装过虚拟机或者有更好的安装技巧可跳过,这只是博主自己安装的方法此安装方式操作的是下 LAMP简介 L:Linux操作系统A:Apache网页服务器M:Mysql数据库管理系统P:Php脚本语言 注:以下开始进行的是分步安装,如果...
阅读 2943·2021-10-08 10:05
阅读 2326·2021-09-26 10:18
阅读 3110·2021-09-22 10:02
阅读 2898·2019-08-30 15:44
阅读 3188·2019-08-30 15:44
阅读 1679·2019-08-29 15:25
阅读 2309·2019-08-26 14:04
阅读 1855·2019-08-26 12:15