Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not running the class from metro loader module #184

Open
dharmendrashah opened this issue Apr 14, 2020 · 4 comments
Open

not running the class from metro loader module #184

dharmendrashah opened this issue Apr 14, 2020 · 4 comments

Comments

@dharmendrashah
Copy link

`
C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\metro-config\src\defaults\blacklist.js:34
  return new RegExp(
         ^

SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
    at new RegExp (<anonymous>)
    at blacklist (C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\metro-config\src\defaults\blacklist.js:34:10)
    at getBlacklistRE (C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\react-native\local-cli\util\Config.js:56:10)
    at Object.<anonymous> (C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\react-native\local-cli\util\Config.js:71:20)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Module._compile (C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\pirates\lib\index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Object.newLoader [as .js] (C:\Users\hp\Desktop\chatApplicationTest\3\node_modules\pirates\lib\index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
`

solve this issue its important

@vinibiso
Copy link

vinibiso commented Apr 29, 2020

Same problem!
I downloaded the zip instead of cloning.
Don't know if that makes a difference.

edit:
Further testin i believe this is a problem with the paths on Windows specifically.
On mac it worked fine.

@exlnt
Copy link

exlnt commented May 3, 2020

I cloned the repo and ran into this same issue! I am running on windows. Is there any solution?

This helps fix the error but the app still does not launch.

@Moumit
Copy link

Moumit commented Sep 3, 2020

With this full replacement on node_modules\metro-config\src\defaults\blacklist.js the issue resolved and app is running on VSCode

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 */
"use strict";

var path = require("path"); // Don't forget to everything listed here to `package.json`
// modulePathIgnorePatterns.

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

function escapeRegExp(pattern) {
  if (Object.prototype.toString.call(pattern) === "[object RegExp]") {
    return pattern.source.replace(/\//g, path.sep);
  } else if (typeof pattern === "string") {
    var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); // convert the '/' into an escaped local file separator

    return escaped.replace(/\//g, "\\" + path.sep);
  } else {
    throw new Error("Unexpected blacklist pattern: " + pattern);
  }
}

function blacklist(additionalBlacklist) {
  return new RegExp(
    "(" +
      (additionalBlacklist || [])
        .concat(sharedBlacklist)
        .map(escapeRegExp)
        .join("|") +
      ")$"
  );
}

module.exports = blacklist;

@janiez
Copy link

janiez commented Sep 13, 2020

In my case for Windows and Nodejs 12 I required the follow.

  • Add this setting into package.json
    {
    ...
    "resolutions": {
    "metro-config": "bluelovers/metro-config-hotfix-0.56.x",
    "graceful-fs": "4.2.4"
    },
    ...
    }
  • yarn install
  • react-native run-android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants