Mac下的安裝步驟
在所有安裝操作開始前,我們需要安裝Homebrew,有關(guān)Homebrew的安裝使用如下語句:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
有關(guān)Homebrew的更多信息請參考官網(wǎng):http://brew.sh/index_zh-cn.html
在Homebrew安裝完成后黍析,便可以開始安裝React Native,此時需要執(zhí)行的語句如下:
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基本上已經(jīng)安裝完成了,我們可以通過創(chuàng)建一個測試項目來驗證React Native是否安裝成功,項目的創(chuàng)建語句如下:
react-native init AwesomeProject
cd AwesomeProject
react-native run-ios
有關(guān)React Native的更多操作,請見官網(wǎng):https://facebook.github.io/react-native/docs/getting-started.html#content
關(guān)于node的安裝
此時可能會出現(xiàn)問題娩怎,造成不完全的安裝搔课,采用如下步驟可以解決node的安裝問題
此時的解決思路為,分別執(zhí)行如下語句:
- Update Homebrew
brew update
- Remove node/npm everywhere on your system
$ 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
- Open a new terminal and install node
$ brew install node
安裝成功后如下所示:
相關(guān)鏈接:http://stackoverflow.com/questions/12607155/error-the-brew-link-step-did-not-complete-successfully