React native - Invalid regular expression error

I tried to run my react native project using expo start command, everything was fine but I got this error -

error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class.

Metro Bundler process exited with code 1
Error: Metro Bundler process exited with code 1
    at ChildProcess.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\src\start\startLegacyReactNativeServerAsync.ts:271:16)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:467:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

This is my package.json file -

{
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.5",
    "expo": "^33.0.0",
    "expo-font": "~5.0.1",
    "expo-splash-screen": "~0.10.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "^0.5.4",
    "native-base": "^2.15.2",
    "react": "16.8.3",
    "react-dom": "16.8.3",
    "react-native": "0.59.8",
    "react-native-event-listeners": "^1.0.7",
    "react-native-gesture-handler": "~1.2.1",
    "react-native-paper": "^4.8.1",
    "react-native-reanimated": "1.0.1",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "1.0.0-alpha.22",
    "react-native-unimodules": "~0.13.3",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0"
  },
  "private": true,
  "name": "ultimate-quiz",
  "version": "1.0.0"
}

And this is in mine node_modules\metro-config\src\defaults\blacklist.js -

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

Upvotes: 1

Views: 1072

Answers (1)

Jignesh Mayani
Jignesh Mayani

Reputation: 7193

Have a try by replacing the sharedBlacklist, Hope it will work for you as it works for me.

In your node_modules\metro-config\src\defaults\blacklist.js

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__\/.*/
];

Upvotes: 1

Related Questions