Hello, React Native

这个东西最近比较火,我也忍不住拿来研究一番

  1. 安装Node
    brew install node
    设置镜像
    npm config set registry https://registry.npm.taobao.org --global
    npm config set disturl https://npm.taobao.org/dist --global
  2. 安装Yarn, Facebook提供的替代npm的工具,可以加速node模块的下载
    brew install yarn
    设置镜像
    yarn config set registry https://registry.npm.taobao.org --global
    yarn config set disturl https://npm.taobao.org/dist --global
    注意不建议使用npm安装yarn,参见https://yarnpkg.com/lang/en/docs/install/#alternatives-tab
    Note: Installation via npm is generally not recommended. npm is non-deterministic, packages are not signed, and npm does not perform any integrity checks other than a basic SHA1 hash, which is a security risk when installing system-wide apps.
    For these reasons, it is highly recommended that you install Yarn through the installation method best suited to your operating system.
  3. 安装React Native的命令行工具(react-native-cli)
    npm install -g react-native-cli
    4.安装Xcode或者Android Studio
  4. 安装Watchman以及官方推荐的Atom插件Nuclide
    brew install watchman
    Nuclide只能在Atom中起一个server,运行应用还得回到命令行react-native run-xxx

预备工作完成,可以开始创建一个项目了:
react-native init HelloWorld
cd HelloWorld
react-native run-ios 或者 react-native run-android
注意项目创建后名字不能随便改,否则会出错,另外项目不要起名太高端,比如叫ReactNative,这种名字会给自己找麻烦,对,我就找了一回。
还要注意运行安卓之间必须保证有模拟器已经在运行中。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 前言 上一节,我们讲了React native以及相关配套软件的安装. 如果还有任何疑问,可以查看 React N...
    Monkey_ALin阅读 1,114评论 0 1
  • -------------如果你使用的是Mac OS系统,请参照以下步骤----------- 安装前注意: 1)...
    Lucky丶晴阅读 570评论 0 3
  • 大道理我都懂,可还是过不好这一生。 我是一怪咖,这事儿我说过无数次了。 我求知欲啊,好奇心啊都特强。很喜欢听故事,...
    Abbyyyyyy666阅读 276评论 1 1
  • 在某个夜黑风高的夜晚 我清晰的认识到我的内心其实是阴暗面大于晴朗面的。 我自打出生以来对自己的定位就是我要做一个...
    Wildcats阅读 4,275评论 2 1
  • 那时候没有手机没有QQ和Email也没有微信 绿皮的单车粗糙的信封八分的邮戳挟带着夏夜的阵雨与蛙声 那时候没有理想...
    北纬二十四度阅读 221评论 0 0