运行时错误:hmrClient.send不是函数

时间:2019-11-21 15:00:56

标签: react-native microsoft-metro

将RN从0.59.10升级到0.61.4后,我得到:

  

TypeError:hmrClient.send不是函数

在尝试启动应用程序时。只需按开除就可以了。

其他人建议删除metrometro-core并进行设置

metro-react-native-babel-preset设置为0.56,但这似乎对我不起作用。

问题在这里报告:

https://github.com/facebook/react-native/issues/26958

2 个答案:

答案 0 :(得分:1)

每次运行/刷新应用程序时,我都会显示相同的错误,并且快速刷新对我不起作用。我有一个React Native(0.63.3)应用,它的init不带博览会。

这对我有用:

yarn add metro@0.56.0

来自:https://www.gitmemory.com/issue/react-native-community/releases/140/530142204

答案 1 :(得分:0)

问题与旧的metro-config模块有关。

我有一个旧版本的"react-native-fs": "2.13.3"。这取决于metro-config@0.48.3

我将react-native-fs更新为2.16.2(对于RN 2.16.x建议使用0.60+),错误消失了。

我还要确保在package.json中我有:"metro-react-native-babel-preset": "0.56.0"

来源:

我从这里得到 huntie 的答案的metro-config提示:

https://github.com/facebook/react-native/issues/26958#issuecomment-558653561

注意:如果您有一个旧的依赖项,无法通过添加以下内容进行更新:

  "resolutions": {
    "metro-config": "0.56.3"
  },
package中的

.json也可以解决此问题。