error Invalid regular expression

I launch a new project after the expo int with the tabs template.
This error is issued:

C:\Projects\Apps\development\ExpoApps\Apps\ibfb>npm start

> @ start C:\Projects\Apps\development\ExpoApps\Apps\ibfb
> expo start

Starting project at C:\Projects\Apps\development\ExpoApps\Apps\ibfb
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
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
Set EXPO_DEBUG=true in your env to view the stack trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Owner\AppData\Roaming\npm-cache\_logs\2019-11-07T11_55_26_632Z-debug.log

EXPO DIAGNOSTICS:

Expo CLI 3.4.1 environment info:
System:
OS: Windows 10
Binaries:
npm: 6.12.1 - C:\Users\Owner\AppData\Roaming\npm\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5977832

Hi

Try setting EXPO_DEBUG to true before starting expo to see if you get more information about where the problem happens.

Something like this:

C:\Projects\testapp>echo %EXPO_DEBUG%
%EXPO_DEBUG%

C:\Projects\testapp>set EXPO_DEBUG=true

C:\Projects\testapp>echo %EXPO_DEBUG%
true

C:\Projects\testapp>expo start

Also, do you by any chance have something mentioning __fixtures__ or heapCature etc. in app.json, package.json or other config files in your project?

The bad regular expression looks like it has Windows path separators (backslashes) in it instead of slashes. It’s possible that running expo start from within bash from WSL will fix this.

EDIT:
Your error message looks suspiciously like this post:

This error occurred when creating a new project after the expo init command and I did not change any configuration files. This is what the expo created. In general, I have not changed anything in the project yet, because it does not start, but produces this error.

Here is the log file:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Owner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.12.1
3 info using node@v13.0.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: C:\Users\Owner\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Projects\Apps\development\ExpoApps\Apps\ibfb\node_modules\.bin;C:\Users\Owner\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Python27\;C:\Python27\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Program Files\nodejs\;C:\Users\Owner\AppData\Local\Microsoft\WindowsApps;C:\Projects\Apps\AndroidStudio\SDK\platform-tools;C:\Users\Owner\AppData\Roaming\npm
9 verbose lifecycle @~start: CWD: C:\Projects\Apps\development\ExpoApps\Apps\ibfb
10 silly lifecycle @~start: Args: [ '/d /s /c', 'expo start' ]
11 silly lifecycle @~start: Returned: code: 1  signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Owner\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:210:5)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Owner\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:210:5)
13 verbose stack     at maybeClose (internal/child_process.js:1028:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @
15 verbose cwd C:\Projects\Apps\development\ExpoApps\Apps\ibfb
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Owner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v13.0.1
19 verbose npm  v6.12.1
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `expo start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Can you try this from WSL instead of cmd.exe or powershell?

if you tell in more detail - how?

There is a bug in Metro: https://github.com/facebook/metro/commit/7c6f30b592b2fb23cee55b54f1aa4b7a522dec18

Downgrading to Node.js 12.8 will resolve this

2 Likes

Yes, this solved the problem. Thank you so much!!!

Got this issue today on windows , but don’t need to downgrade node, just as discussed on stackoverflowjust need to change some hashes on your project:

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

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

Hope it works like worked for me :slight_smile:

1 Like