Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting Invalid regular expression error while running npm start

I have recently installed the expo. I have created a project using expo init. After creation when I running npm start I am getting below error please slove my issue

> @ start C:\Users\ujwal\Desktop\Java\my-new-project
> expo start

Starting project at C:\Users\ujwal\Desktop\Java\my-new-project
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\ujwal\AppData\Roaming\npm-cache\_logs\2019-10-07T11_19_27_567Z-debug.log
like image 448
user3359125 Avatar asked Oct 07 '19 11:10

user3359125


People also ask

Why is my NPM start script missing?

When your package.json file doesn’t have the start command under the scripts property, then NPM will run node server.js instead. When you run the npm start command, you may encounter an error saying that the start script is missing: $ npm start npm ERR!

Why is NPM err err error parsing JSON?

npm ERR! registry error parsing json Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. This can be caused by corporate proxies that give HTML responses to package.json requests.

Why am I getting NPM err error when installing a package?

It's most likely a temporary npm registry glitch. Check npm server status and try again later. If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package. npm ERR!

Why am I getting a SyntaxError in NPM?

It's most likely a temporary npm registry glitch. Check npm server status and try again later. If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package. npm ERR! SyntaxError: Unexpected token <


2 Answers

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....

like image 145
Kishan Gujarati Avatar answered Sep 29 '22 20:09

Kishan Gujarati


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.

like image 39
brunovianarezende Avatar answered Sep 29 '22 20:09

brunovianarezende