React Native 環(huán)境搭建 遇到的錯(cuò)誤整理

環(huán)境搭建

  • <a >官網(wǎng)</a>

  • <a >中文社區(qū)</a>

  • <a >研究中的 github</a>
  • 錯(cuò)誤0


   ###解決方法:手動(dòng)設(shè)置IP
   
   - RCTBundleURLProvider在接口中暴露了jsLocation屬性,可以通過setJsLocation手動(dòng)設(shè)置IP。
  
    <span>
    ```
      NSURL *jsCodeLocation;

      [[RCTBundleURLProvider sharedSettings] setDefaults];
      #if DEBUG
      [[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.1.101"];
      #endif
      jsCodeLocation = [[RCTBundleURLProvider sharedSettings]     
      jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

</span>
<a >傳送門</a>

  • 錯(cuò)誤1

    2016-09-24 10:57:56.432 [warn][tid:main][RCTEventEmitter.m:54] Sending websocketFailed with no listeners registered.
    2016-09-24 10:57:56.471 [info][tid:com.facebook.react.JavaScript] Running application "HelloWorld" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF

    
    

解決方法:

本地服務(wù)器未啟動(dòng) sudo npm start

  • 錯(cuò)誤2

    2016-09-24 11:01:14.620 HelloWorld[56128:350791] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.


###解決方法:
禁用https : 
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

* ##錯(cuò)誤3
>```
You are currently running Node v0.12.0 but React Native requires >=4. Please use a supported version of Node.
See https://facebook.github.io/react-native/docs/getting-started.html

解決方法:

安裝一個(gè)nvm,通過nvm安裝一個(gè)nodejs4.0以上的版本

<span>

  • brew install nvm

  • vim bash_profile 添加自動(dòng)啟動(dòng)

    • export NVM_DIR=~/.nvm
    • source $(brew --prefix nvm)/nvm.sh
  • source bash_profile

  • nvm install v4.2.4

  • sudo react-navtive init HelloWorld(項(xiàng)目名稱)
    </span>
    <a >傳送門1</a>
    <a href = "http://www.lxweimin.com/p/078d9900a7c8">傳送門2</a>

  • 錯(cuò)誤4

    項(xiàng)目init 成功 但是無讀寫權(quán)限

    解決辦法:

    <a >傳送門<a>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容