Search code examples
node.jsreact-nativenode-modulesmetro-bundler

`HMRClient` does not exist in the Haste module map - project fail to run after `npm install`


I have used node 8.x and I upgraded to new node 12.13.0 using brew.
I tried to run project after this and it was working fine.
Then I did npm install ofSomePackage and I got message like:

added 55 packages from 59 contributors, removed 536 packages, moved 16 packages and audited 905939 packages in 46.187s
found 13236 vulnerabilities (44 low, 8 moderate, 13183 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

npm audit ask to use npm install I did nothing changed.
When I tried to run project I get that some packages are missing so I install missing packages again. But I stuck on this:

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `metro/src/lib/bundle-modules/HMRClient` from `/Users/me/.../node_modules/react-native/Libraries/Utilities/HMRClient.js`: Module `metro/src/lib/bundle-modules/HMRClient` does not exist in the Haste module map

I checked and that file exist. Please help.


Solution

  • I'd try resetting the packager server's cache. Sometimes it gets out of kilter with what's on the fs and if lucky that'll fix it.

    With the react native cli (I'd guess expo based dev has something similar) restart server with

    react-native start --reset-cache