내가 효과가 있던 방법.

KalebPortillo commented on 24 Aug 2019

I was stuck in the same issue, but I coudn`t jsut start a new react-native project and migrate all files.
So what I did was:

  • Finde the file at path: node_modules/react-native/Libraries/Utilities/HMRClient.js and change the line: const MetroHMRClient = require('metro/src/lib/bundle-modules/HMRClient');
    to: const MetroHMRClient = require('../../../@react-native-community/cli/node_modules/metro/src/lib/bundle-modules/HMRClient');

Was the only thing that worked for me, the only issue is that if you reinstall de node_modules you will need to replace the line again. Because that I added this script to my package.json:

  • "postinstall": "sed -i '' \"s#metro#../../../@react-native-community/cli/node_modules/metro#g\" ./node_modules/react-native/Libraries/Utilities/HMRClient.js"

The above script takes care of the replacing for after each new npm install

 

MetroHMRClient 주소를 위처럼 변경 해주거나

원본인 require('metro/src/lib/bundle-modules/HMRClient'); 으로 바꿔보기

 

 

+ Recent posts