1

I just create a react native app using the following command:

expo init first-react-native 

And try run this app using

expo start 

But I am getting the following error:

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. Metro Bundler process exited with code 1 

N.B: I am novice to react native and struggling to resolve this issues but no luck. Any idea?

1
  • I think doc said you could also use npm start, see if it has the same issue Commented Oct 23, 2019 at 21:02

1 Answer 1

2

Problem

This is caused by node v12.11.0 due to the way it deals regular location. You can try one of these solutions to resolve this.

Solution 1

Try installing the latest version of Node or you can downgrade to node v12.10.0 this will apply the correct way to deal with parsing error

Solution 2

You can correctly terminate the regular expression in your case by changing the file located in:

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

Hope this Helps!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.