Metro: Error "does not exist in the Haste module map" for already installed packages.

Created on 21 Mar 2019  路  8Comments  路  Source: facebook/metro

Do you want to request a feature or report a bug?
Maybe a bug.

What is the current behavior?

error: bundling failed: Error: Unable to resolve module `@react-native-community/netinfo`  
 from `.../src/containers/Main.js`: Module `@react-native-community/netinfo` does not exist  
 in the Haste module map or in these directories: .../node_modules/@react-native-community

Please Note, this this error is not specific to netinfo. I also had the same issue with react-native-extra-dimensions-android.
What is the expected behavior?
Not throw error for already installed packages.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
Mac OS High Sierra
node: v10.14.1
npm: 6.5.0
react-native: 0.59.1

metro.config.js

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
  resolver: {
    blacklistRE: blacklist([/nodejs-assets\/.*/, /android\/.*/, /ios\/.*/, /unity\/.*/])
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false
      }
    })
  }
};

Following steps did not solve the issue:

  • remove node_modules and reinstalled.
  • ran react-native start --reset-cahce or npm start -- --reset-cache
  • removed haste-map* directories from '/tmp`
  • removed metro-bundler-cache-*
  • cleared watchman

Anyone else having the same issue?

Most helpful comment

I guess this is the reason

npm WARN @react-native-community/[email protected] requires a peer of react-native@>=0.57 <0.59 but none is installed. You must install peer dependencies yourself.

All 8 comments

I guess this is the reason

npm WARN @react-native-community/[email protected] requires a peer of react-native@>=0.57 <0.59 but none is installed. You must install peer dependencies yourself.

Having this same issue when trying to use apollo-client, very frustrating

same here with serialport https://github.com/node-serialport/node-serialport

: Module stream does not exist in the Haste module map

I guess this is the reason

npm WARN @react-native-community/[email protected] requires a peer of react-native@>=0.57 <0.59 but none is installed. You must install peer dependencies yourself.

Did you actually determine this was the root cause? Were you able to resolve it?

I guess this is the reason

npm WARN @react-native-community/[email protected] requires a peer of react-native@>=0.57 <0.59 but none is installed. You must install peer dependencies yourself.

Did you actually determine this was the root cause? Were you able to resolve it?

Unfortunately no. I upgraded the packages to their latest and it works again. Not sure what the issue is.

Also experimenting the issue, i'm using nodejs-websocket and it has dependences from @types/node like net module, and they are already installed but it fails to find it.

Same issue here. Looking for solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vicki15 picture vicki15  路  3Comments

Naturalclar picture Naturalclar  路  4Comments

dlferro picture dlferro  路  5Comments

torkelrogstad picture torkelrogstad  路  4Comments

soh335 picture soh335  路  5Comments