React Native安装教程

2016-08-02  本文已影响0人  wleics

Mac下的安装步骤

在所有安装操作开始前,我们需要安装Homebrew,有关Homebrew的安装使用如下语句:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

有关Homebrew的更多信息请参考官网:http://brew.sh/index_zh-cn.html

在Homebrew安装完成后,便可以开始安装React Native,此时需要执行的语句如下:

brew install node
brew install watchman

Node comes with npm, which lets you install the React Native command line interface.

npm install -g react-native-cli

此时React Native基本上已经安装完成了,我们可以通过创建一个测试项目来验证React Native是否安装成功,项目的创建语句如下:

react-native init AwesomeProject
cd AwesomeProject
react-native run-ios
项目成功创建,并启动完成

有关React Native的更多操作,请见官网:https://facebook.github.io/react-native/docs/getting-started.html#content

关于node的安装

此时可能会出现问题,造成不完全的安装,采用如下步骤可以解决node的安装问题

此时的解决思路为,分别执行如下语句:

brew update
$ brew uninstall npm
$ brew uninstall node
$ npm uninstall npm -g
$ sudo rm -rf /usr/local/lib/node_modules

Note: I had stray node files that I found by running brew -v link node (which gave me the verbose output of the linking errors brew was complaining about). You may need to:

$ sudo rm -rf /usr/local/include/node
$ sudo rm -rf /usr/local/lib/node
$ brew install node

安装成功后如下所示:

node 安装完成

相关链接:http://stackoverflow.com/questions/12607155/error-the-brew-link-step-did-not-complete-successfully

上一篇下一篇

猜你喜欢

热点阅读