question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

metro-config sharedBlacklist regexp without scape "\"

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:39

github_iconTop GitHub Comments

20reactions
ghostcommented, Dec 5, 2019

Replace existing shareBlacklist with this:

var sharedBlacklist = [
  /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
12reactions
blueloverscommented, Dec 24, 2019

https://github.com/facebook/metro/issues/453

for who still get this error without official patch in react-native , expo use yarn and add this setting into package.json

{
  ...
  "resolutions": {
    "metro-config": "bluelovers/metro-config-hotfix-0.56.x"
  },
 ...
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve the error on 'react-native start' - Stack Overflow
Open \node_modules\metro-config\src\defaults\blacklist.js. Replace the following. From var sharedBlacklist = [ /node_modules[/\\]react ...
Read more >
Metro-symlinked-deps - npm.io
The general process for developing on a dependency that is sharing components with the main app would be to use yarn link /...
Read more >
Examples of regular expressions - Google Workspace Admin ...
The following examples illustrate the use and construction of simple regular expressions. Each example includes the type of text to match, one or...
Read more >
Solved: Invalid Regex Error React Native | by Shreyas Nisal
Go into your node_modules directory, and look for metro-config. Next, go into src/defaults, and open the blacklist. js file.
Read more >
Blacklists — designate 2.1.0 documentation
If it matches the regex pattern, then a 400 is returned with the message “Blacklisted domain name”. If there is no match, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found