I am getting Invalid regular expression error while running npm start

It seems like you are experiencing this error: https://github.com/facebook/react-native/issues/26598. Per the issue ticket, you have some alternatives:

First option: downgrade to node 10.16.3 LTS

Second option: if you use Yarn, add a 'resolutions' property to your package.json to point to the metro-config version where the issue is fixed:

  "resolutions": {
    "metro-config": "0.57.0"
  },

Third option: if you use npm instead of yarn, you need to find a way to fix the "metro-config" sub-dependency to "0.57.0". I don't know how to do that, maybe npm-shrinkwrap can help you.


you have to make change in this file {project_root}\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__\/.*/
];

to

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

hope it'll helps you....