Unable to resolve module `./../../react-transform-hmr/lib/index.js`

  • A+
Category:Languages

error: bundling failed: Error: Unable to resolve module ./../../react-transform-hmr/lib/index.js from /ReactNative/UsermanagementNav/src/App.js: The module ./../../react-transform-hmr/lib/index.js could not be found from /ReactNative/UsermanagementNav/src/App.js.

I have tried to install react-native-transform-hmr using

npm i react-native-transform-hmr

but it does not solve my issue. i am using react-native 0.57.2 and react 16.5.0

 


This issue only happens when react-native 0.57.2 is installed. 

It seems like the Metro Bundler has an issue resolving the paths when started from ./node_modules/react-native/scripts/packager.sh.

Starting the Metro Bundler directly from the project directory works for me. Can someone let me know if it works for them too?

Clean cache

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all 

Start Metro Bundler directly

react-native start 

Now run react-native run-android or react-native run-ios in another tab

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:1   其中:访客  1   博主  0

    • ashish choudhary ashish choudhary 0

      This issue only happens when react-native 0.57.2 is installed.
      1. step clean cache (inside of your project with below command)
      rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

      2. Step Run / Start Metro Bundler (inside of your project with below command) don’t close terminal
      react-native start ()
      3. Step
      open new terminal (go to your path of project) like : documents/mydemo and run
      react-native run-ios