Runtime TypeError: hmrClient.send is not a function

流过昼夜 提交于 2020-12-13 03:09:46

问题


After upgrade of RN from 0.59.10 to 0.61.4 I get:

TypeError: hmrClient.send is not a function

when trying to start the app. Just pressing on dismiss seems to work.

Other people suggest removing metro and metro-core and setting

setting metro-react-native-babel-preset to 0.56 but that doesn't seem to work for me.

Issue was reported here:

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


回答1:


The issue was related to an old metro-config module.

I had an old version of "react-native-fs": "2.13.3". This had a dependency on metro-config@0.48.3.

I updated react-native-fs to 2.16.2 (2.16.x is recommended for RN 0.60+) and the error disappeared.

Also I made sure in package.json I have: "metro-react-native-babel-preset": "0.56.0".

Sources:

I got the metro-config hint from huntie's answer from here:

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

Note: if you have an old dependency that cannot be updated adding:

  "resolutions": {
    "metro-config": "0.56.3"
  },

in the package.json could also fix the issue.




回答2:


I had the same error displaying every time I ran/refreshed the app and fast refresh was not working for me. I have a react native (0.63.3) app with an init without expo.

This worked for me:

yarn add metro@0.56.0

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



来源:https://stackoverflow.com/questions/58977868/runtime-typeerror-hmrclient-send-is-not-a-function

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