2016-03-23 44 views
1

編輯:值得注意的我正在開發在Android現在的ReferenceError:找不到變量__fbBatchedBridge

我讓我的ReactNative應用程序的__fbBatchedBridge錯誤。這個問題不是連接到打包者的失敗(證據如下)。當我安裝了一堆軟件包進行測試時,問題就開始了,但即使我恢復時,刪除了node_modules,並且它仍然存在npm install

的package.json

{ 
    "name": "MyApp", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "log": "adb logcat *:S ReactNative:V ReactNativeJS:V" 
    }, 
    "dependencies": { 
    "events": "^1.1.0", 
    "react-native": "^0.18.0", 
    "react-native-push-notification": "^1.0.2", 
    "react-native-scrollable-tab-view": "^0.3.5", 
    "react-native-webrtc": "^0.2.7", 
    "react-redux": "^4.4.0", 
    "redux": "^3.3.1", 
    "socket.io-client": "^1.4.4" 
    }, 
    "devDependencies": { 
    "redux-devtools": "^3.1.1" 
    } 
} 

NPM啓動導致

[7:19:50 PM] <START> Building Dependency Graph 
[7:19:50 PM] <START> Crawling File System 
[7:19:50 PM] <START> Loading bundles layout 
[7:19:50 PM] <END> Loading bundles layout (0ms) 

React packager ready. 

[7:19:53 PM] <START> request:/index.android.bundle?platform=android&dev=true 
[7:19:53 PM] <START> find dependencies 
[7:19:56 PM] <END> Crawling File System (5686ms) 
[7:19:56 PM] <START> Building in-memory fs for JavaScript 
[7:19:56 PM] <END> Building in-memory fs for JavaScript (346ms) 
[7:19:56 PM] <START> Building in-memory fs for Assets 
[7:19:56 PM] <END> Building in-memory fs for Assets (322ms) 
[7:19:56 PM] <START> Building Haste Map 
[7:19:56 PM] <START> Building (deprecated) Asset Map 
[7:19:57 PM] <END> Building (deprecated) Asset Map (87ms) 
[7:19:57 PM] <END> Building Haste Map (452ms) 
[7:19:57 PM] <END> Building Dependency Graph (6811ms) 
[7:19:57 PM] <END> find dependencies (4018ms) 
[7:19:57 PM] <START> transform 
transforming [========================================] 100% 549/549 
[7:20:00 PM] <END> transform (3417ms) 
[7:20:00 PM] <END> request:/index.android.bundle?platform=android&dev=true (7463ms) 

正如你所看到的,打包包裝和發送束Genymotion,這是再提高錯誤。

+0

ios和javascript之間的原生版本是否匹配? – everlasto

+0

我現在只爲Android開發,但是。 – wmjbyatt

回答

1

此問題已經在更新版本的React Native中得到解決。我會建議你把你的版本升級到0.22

但是,如果你正在尋找臨時的解決辦法比node_modules/react-native/packager/packager.sh

更換

if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then 
    echo "Skipping bundling for Simulator platform" 
    exit 0; 
fi 

# if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then   
#  echo "Skipping bundling for Simulator platform"  
#  exit 0;  
# fi 
+0

升級React Native做到了。謝謝。 – wmjbyatt

0

在AppDelegate.m文件,我們將使用:

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 

而不是:

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 

它適合我。

0

從終端:

adb shell input keyevent 82

Genymotion開放開發菜單,進入開發設置

然後:adb shell input text <your IPv4 adress>:8081

最後:

adb reverse tcp:8081 tcp:8081

+0

我已經說過我可以很好地連接到打包程序 – wmjbyatt

相關問題