运行命令:node ./node_modules/react-native/local-cli/cli.js run-android
或react-native run-android
我收到错误“要求未知模块react / lib / ReactNative” 追踪:
E/unknown:React: Exception in native call from JS
java.lang.RuntimeException: Error: Requiring unknown module "react/lib/ReactNative". (index.android.bundle:2)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(Native Method)
at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:37)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:177)
at com.facebook.react.XReactInstanceManagerImpl$4.call(XReactInstanceManagerImpl.java:888)
at com.facebook.react.XReactInstanceManagerImpl$4.call(XReactInstanceManagerImpl.java:881)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$1.run(MessageQueueThreadImpl.java:74)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:761)
“babel-preset-react-native”:1.9.2
“反应”:“^ 15.4.1”
“react-native”:“^ 0.31.0”
编辑:
我上传了整个verbose Android Monitor output here:
它实际上有很多可疑相关的警告,但我很难联系到,例如:
1)先说
W/unknown:InspectorPackagerConnection: Couldn't connect to packager, will silently retry
然后说:
W/unknown:React: Packager connection already open, nooping.
W/unknown:React: Inspector connection already open, nooping.
3)还列出了:
W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.XXX
答案 0 :(得分:0)
可能与下面建议的热重新加载有关吗?
需要未知模块" react-native"。 #6753 https://github.com/facebook/react-native/issues/6753