React Native CLI error: Invalid regular expression: /(.*\\__fixtures__


Sample error:

D:\VueNative\demo>npm start

> demo@0.0.1 start D:\VueNative\demo
> node node_modules/react-native/local-cli/cli.js start

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 detai
ls.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo@0.0.1 start: `node node_modules/react-native/local-cli/cli.js star
t`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-12-04T0
3_38_09_097Z-debug.log

NodeJS version: v14.7.0

Solution: Edit file node_modules\metro-config\src\defaults\blacklist.js

Line 14-19

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

Change to:

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

Done

Recent search terms:

  • src\defaults\blacklist js:38

Leave a Reply