{"id":5555,"date":"2016-11-27T02:02:16","date_gmt":"2016-11-26T18:02:16","guid":{"rendered":"https:\/\/sdeno.com\/?p=5555"},"modified":"2016-12-26T00:54:55","modified_gmt":"2016-12-25T16:54:55","slug":"react-native%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=5555","title":{"rendered":"react native\u73af\u5883\u642d\u5efa \u4ee5\u53canvm\u5b89\u88c5\u548c\u4f7f\u7528"},"content":{"rendered":"<p>\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u4f7f\u7528os x\u7cfb\u7edf\u642d\u5efa\u3002<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8211;\u73af\u5883&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>1\uff0c\u5b89\u88c5xcode\u53ef\u4ee5\u53bbapp store\u4e0b\u8f7d<\/p>\n<p>2\uff0cxcode-select &#8211;install \/\/\u8c8c\u4f3c\u82f9\u679c\u81ea\u5e26\u5c31\u5b89\u88c5\u597d\u4e86\u4e0d\u8fc7\u6700\u597d\u4e5f\u6267\u884c\u4e00\u6b21\u770b\u662f\u5426\u5b89\u88c5<\/p>\n<p>3\uff0c\u63a8\u8350\u5b89\u88c5brew\uff0c\u6559\u7a0b\u53c2\u8003\u300a<a href=\"https:\/\/sdeno.com\/?p=5545\" target=\"_blank\">mac\u4f7f\u7528\u7c7b\u4f3cubuntu\u7684apt-get\u547d\u4ee4\u5b89\u88c5\u8f6f\u4ef6\u2014\u2014brew<\/a>\u300b<\/p>\n<p>4\uff0c\u4e4b\u540e\u4f7f\u7528brew\u5b89\u88c5\u5de5\u5177\uff0cbrew install watchman flow git gcc pkg-config cairo libpng jpeg gitlab-ci-multi-runner mongodb<\/p>\n<p>5\uff0c\u5b89\u88c5nvm\u5de5\u5177\uff0c\u4e3a\u4e86node.js\u591a\u7248\u672c\u5171\u5b58<\/p>\n<pre>sudo curl -o- https:\/\/raw.githubusercontent.com\/creationix\/nvm\/v0.32.1\/install.sh | bash<\/pre>\n<p>\u5b89\u88c5\u540e\u8fd8\u4e0d\u80fd\u9a6c\u4e0a\u4f7f\u7528\uff0c\u5728\u547d\u4ee4\u754c\u9762\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u4e24\u884c\u547d\u4ee4\uff1a\u7c7b\u4f3c\u914d\u7f6e\u53d8\u91cf\u73af\u5883<\/p>\n<pre>export NVM_DIR=\"\/Users\/xgllseo\/.nvm\"  \/\/\u8fd9\u91cc\u6839\u636e\u81ea\u5df1\u76ee\u5f55\u8bbe\u7f6e\r\n[ -s \"$NVM_DIR\/nvm.sh\" ] &amp;&amp; . \"$NVM_DIR\/nvm.sh\" # This loads nvm<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4e4b\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528nvm\u5b89\u88c5\u591a\u4e2anode.js\u7248\u672c\u5171\u5b58\u4e86\uff0c\u4f8b\u5982\u5b89\u88c5\uff1a<br \/>\nnvm install v4.2.3<br \/>\n\u4e4b\u540e\u8bbe\u7f6e\u4f7f\u7528\u8be5\u7248\u672c<br \/>\nnvm alias default v4.2.3<br \/>\n\u8fd9\u6837\u5c31\u53ef\u4ee5\u4f7f\u7528node.js\u7248\u672c\u597d\u98df4.2.3\u4e86<\/p>\n<p>\u4f46\u662f\u6709\u4e00\u4e2a\u5751\u7684\u5730\u65b9\u5c31\u662f\u6bcf\u6253\u5f00\u4e00\u4e2a\u547d\u4ee4\u7a97\u53e3\u65f6\u4f60\u4f1a\u53d1\u73b0\u53c8\u4e0d\u80fd\u4f7f\u7528nvm\u7684\u547d\u4ee4\uff0c\u548c\u5305\u62ec\u7528nvm\u5b89\u88c5\u7684node.js\u547d\u4ee4\u4e86\u3002<br \/>\n\u5728~\/.zshrc\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6.zshrc\u5185\u5bb9\u6dfb\u52a0\u4e0a\uff1a<\/p>\n<pre>export NVM_DIR=\"\/Users\/xgllseo\/.nvm\"\r\n[ -s \"$NVM_DIR\/nvm.sh\" ] &amp;&amp; . \"$NVM_DIR\/nvm.sh\" # This loads nvm<\/pre>\n<p>\u4ee5\u540e\u6bcf\u6b21\u6253\u5f00\u4e00\u4e2a\u547d\u4ee4\u7a97\u53e3\u65f6\u6267\u884c\u4e00\u4e0b<\/p>\n<pre>source ~\/.zshrc<\/pre>\n<p>\u5c31\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u4e86\uff0c\u8fd9\u6837\u662f\u628a\u672c\u6765\u6267\u884c\u4e24\u53e5\u8bdd\u7684\u7f29\u77ed\u4e3a\u6267\u884c\u4e00\u6b21\u3002<\/p>\n<p>\u6211\u5e0c\u671b\u6bcf\u6b21\u6253\u5f00\u547d\u4ee4\u7a97\u53e3\u65f6\u90fd\u81ea\u52a8\u5728\u5f53\u524d\u7a97\u53e3\u6267\u884c\u4e00\u4e0bsource ~\/.zshrc\uff0c\u5c31\u514d\u5f97\u6bcf\u6b21\u90fd\u6267\u884c\u4e86\u3002<br \/>\n\u7f16\u8f91\u6587\u4ef6\/etc\/bashrc\uff0c\u5728\u6700\u540e\u4e00\u884c\u52a0\u4e0a<\/p>\n<pre>source ~\/.zshrc<\/pre>\n<p>\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>6\uff0c\u4e0b\u8f7dreact native\u4e00\u4e2a\u7b80\u5355\u6848\u4f8b\u7684\u9879\u76ee\u5305\uff0c\u5728\u4f7f\u7528cnpm\u547d\u4ee4\u4e4b\u524d\u4e5f\u9700\u8981\u5b89\u88c5npm install cnpm -g<\/p>\n<pre>cnpm install -g react-native-cli@0.1.10\r\nreact-native -v \/\/\u67e5\u770b\u662f\u5426\u5b89\u88c5\u5b8c\u6210<\/pre>\n<p>7\uff0c\u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u5728\u76ee\u5f55\u4e2d\u8fd0\u884c\u547d\u4ee4\uff1a<\/p>\n<pre>react-native init \u81ea\u5b9a\u4e49\u9879\u76ee\u540d      (\u80fd\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u662f\u4e4b\u524d\u5168\u5c40\u5b89\u88c5\u4e86react-native-cli)<\/pre>\n<p>8\uff0c\u8fdb\u5165\u5230\u4f60\u7684\u81ea\u5b9a\u4e49\u9879\u76ee\u540d\u4e2d\u627e\u5230\u76ee\u5f55ios\/\u81ea\u5b9a\u4e49\u9879\u76ee\u540d.xcodeproj\uff0c\u53cc\u51fb\u540e\u7f00\u662fxcodeproj\u7684\u6587\u4ef6\uff0c\u5c31\u6253\u5f00\u4e86xcode\u7a0b\u5e8f\uff0c\u7136\u540e\u70b9\u51fb&#8221;run&#8221;\uff0c\u5c31\u4f1a\u5f39\u51fa\u4e00\u4e2aiphone\u6a21\u62df\u7684\u7a97\u53e3\uff0c\u5b8c\u6210\u3002<\/p>\n<p>(\u6ce8\u610f\uff1a\u4f7f\u7528\u7684\u4e00\u7cfb\u5217\u547d\u4ee4\u4f8b\u5982\uff1anode npm cnpm react-nativ\u90fd\u662f\u57fa\u4e8e\u4e4b\u524d\u7528nvm\u547d\u4ee4\u6765\u5b89\u88c5\u7684\uff0c\u6240\u4ee5\u7b2c5\u6b65\u5f88\u91cd\u8981)<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u91cc\u53ea\u4ecb\u7ecd\u4f7f\u7528os x\u7cfb\u7edf\u642d\u5efa\u3002 &#8212;&#8212;&#8212;&#8212;&#8211;\u73af\u5883&#038; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[],"class_list":["post-5555","post","type-post","status-publish","format-standard","hentry","category-mac"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5555"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5555\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}