Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'metro/src/blacklist' #21093

Closed
3 tasks done
tapz opened this issue Sep 13, 2018 · 12 comments
Closed
3 tasks done

Cannot find module 'metro/src/blacklist' #21093

tapz opened this issue Sep 13, 2018 · 12 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@tapz
Copy link

tapz commented Sep 13, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
Memory: 440.67 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/opt/node@8/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/opt/node@8/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 21.1.1, 21.1.2, 22.0.0, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.0, 26.0.2, 27.0.3, 28.0.0
API Levels: 22, 24, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4697961
Xcode: 10.0/10A254a - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.0 => 0.57.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

(node:94806) UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/blacklist'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)

@react-native-bot

This comment has been minimized.

@tapz

This comment has been minimized.

@mgcrea
Copy link

mgcrea commented Sep 13, 2018

Are you using a custom rn-cli.config.js?

If yes, you should update the code related to requiring blacklist to something like:

try {
  // >= 0.57
  blacklist = require('metro-config/src/defaults/blacklist');
} catch (e) {
  // <= 0.56
  blacklist = require('metro/src/blacklist');
}

@tapz
Copy link
Author

tapz commented Sep 13, 2018

I'm not using a custom rn-cli.config.js. But the one in the project directory looks like this:

const blacklist = require('metro/src/blacklist')
  module.exports = {
    getBlacklistRE () {
      return blacklist([/react-native\/local-cli\/core\/__fixtures__.*/])
    },
  }

@mgcrea
Copy link

mgcrea commented Sep 13, 2018

Maybe you should try to rm -rf node_modules; yarn.

@tapz
Copy link
Author

tapz commented Sep 13, 2018

I have removed node_modules. But I changed the rn-cli.config.js per your instructions and at least now got the react-native info working. Probably the metro bundler too. Next have to figure out how to resolve the RN issues with XCode 10 GM. Really hate wasting time with fighting with buggy RN...

@owinter86
Copy link

owinter86 commented Sep 13, 2018

You will need to update the rn-cli.config.js per the upgrade guide. https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#updating-to-this-version see point number 4

change the blacklist import to.
const blacklist = require('metro-config/src/defaults/blacklist')

@tapz
Copy link
Author

tapz commented Sep 13, 2018

Whats in the line // ... where alternateRoots should be defined? Would be nice to have the whole file in the guide.

@tapz
Copy link
Author

tapz commented Sep 13, 2018

Also: (node:17719) UnhandledPromiseRejectionWarning: Error: Cannot find module './scripts/transformer.js'

@owinter86
Copy link

This is your new file.

const blacklist = require('metro-config/src/defaults/blacklist')
  module.exports = {
    getBlacklistRE () {
      return blacklist([/react-native\/local-cli\/core\/__fixtures__.*/])
    },
  }

@owinter86
Copy link

Sorry, I just realised the blackListing reference is incorrect, it should be.

const blacklist = require('metro-config/src/defaults/blacklist')
  module.exports = {
  resolver: {
    blacklistRE: blacklist([/react-native\/local-cli\/core\/__fixtures__.*/]),
  },
};

@kelset
Copy link
Contributor

kelset commented Sep 17, 2018

I feel that we can close this now, since this is also shown in the changelog for 0.57 https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#updating-to-this-version

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants