Ask questionsmetro-config sharedBlacklist regexp without scape "\"

<!-- Before creating an issue please make sure you are using the latest version of Metro, try re-installing your node_modules folder and run Metro once with --reset-cache to see if that fixes the problem you are experiencing. -->

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

What is the current behavior? When i try to run react-native start an error is outputed

error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
    at new RegExp (<anonymous>)
    at blacklist (C:\Users\***\react\myApp\node_modules\metro-config\src\defaults\blacklist.js:34:10)
    at getBlacklistRE (C:\Users\***\react\myApp\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:69:59)
    at getDefaultConfig (C:\Users\***\react\myApp\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:85:20)
    at load (C:\Users\***\react\myApp\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:121:25)
    at Object.runServer [as func] (C:\Users\***\react\myApp\node_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)
    at Command.handleAction (C:\Users\***\react\myApp\node_modules\@react-native-community\cli\build\cliEntry.js:160:21)
    at Command.listener (C:\Users\***\react\myApp\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:210:5)
    at Command.parseArgs (C:\Users\***\react\myApp\node_modules\commander\index.js:651:12)

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm - =-- - version and operating system.

  • See above for metro config.
  • Windows 10 x64
  • node v12.11.0
  • npm@6.11.3
  • metro@0.56.0
  • metro-config@0.56.0

Answer questions armohammadi56

I just got a similar error for the first time today. It appears in \node_modules\metro-config\src\defaults\blacklist.js, there is an invalid regular expression that needed changed. I changed the first expression under sharedBlacklist from:

var sharedBlacklist = [ /node_modules[/\]react[/\]dist[/\]./, /website/node_modules/./, /heapCapture/bundle.js/, /./tests/./ ];


var sharedBlacklist = [ /node_modules[/\]react[/\]dist[/\]./, /website/node_modules/./, /heapCapture/bundle.js/, /./tests/./ ];


Related questions

ReferenceError: SHA-1 for file [(...).png] is not computed hot 2
i have local javascript library How do i config metro.config.js hot 2
`SHA-1 for file ... is not computed` when using `resolver.resolveRequest` hot 1
Follow symlinks? hot 1
`SHA-1 for file ... is not computed` when using `resolver.resolveRequest` hot 1
bundleReleaseJsAndAssets slow for react-native 0.60 / node v12 combo hot 1
Error: Cannot find module 'metro/src/DeltaBundler/Worker' hot 1
concurrent builds fail due to shared use of /tmp/metro-cache/ hot 1
Minification can break code (but cannot be disabled?) hot 1
Error: Cannot find module 'metro/src/DeltaBundler/Worker' hot 1
RN - Error: jest-haste-map: @providesModule naming collision hot 1
Couldn't find preset "module:metro-react-native-babel-preset" when running jest hot 1
Github User Rank List