Error after installing Realm: Must first create RPC session with a valid host

空扰寡人 提交于 2020-01-14 07:42:10

问题


I recently installed realm using:

npm i realm -S
react-native link realm

Important edit This issue only occurs when debugging from device

Everything still works but this time, when I try to enable Debug Js Remotely from the development menu, I get the error Must first create RPC session with a valid host. Remote debugging used to work and the development server is still running on port 8081 as it used to be.

If there is any code example you want, please let me know. Realm is not invoked until later.

From package.json:

{
  "name": "ExampleProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "babel-jest": "^20.0.1",
    "babel-preset-react-native": "1.9.1",
    "jest": "^20.0.1",
    "react": "16.0.0-alpha.6",
    "react-native": "^0.44.0",
    "react-native-device-detection": "^0.1.3",
    "react-native-elements": "^0.11.2",
    "react-native-orientation": "git+https://github.com/yamill/react-native-orientation.git",
    "react-native-scrollable-tab-view": "^0.6.5",
    "react-native-vector-icons": "^4.1.1",
    "react-navigation": "^1.0.0-beta.9",
    "react-test-renderer": "16.0.0-alpha.6",
    "realm": "^1.3.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Error:

Realm's Issue tracker mentioned it once "somewhere" but I couldn't find a fix. Has anyone seen this message before and can you point me in the right direction to fix this?


回答1:


There might be a better answer in the future or not at all. So, here's what I found.

I'm not really sure what solves this issue. At least, make sure that realm's port (8082 by default) is reachable on your device by commanding adb forward tcp:8082 tcp:8082 in a terminal.

Furthermore, make sure the device is connected(!) to the same subnet/network to avoid any packet dropping.

Try completely removing the app from the device (reset) in combination with shutting down the packager and re-running react-native run-android / running from xcode.

I don't believe there is a uniform solution yet at the time of writing.



来源:https://stackoverflow.com/questions/44016885/error-after-installing-realm-must-first-create-rpc-session-with-a-valid-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!