React Native报错SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/:

今天在公司拉下项目link的时候,react native报了这样的错误

 

1.Error log:

 

E:\project\my\scanner-qrcode-master\node_modules\metro-config\src\defaults\blacklist.js:38

  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 (E:\project\my\react-native-scanner-qrcode-master\node_modules\metro-config\src\defaults\blacklist.js:38:10)

    at getBlacklistRE (E:\project\my\react-native-scanner-qrcode-master\node_modules\react-native\local-cli\util\Config.js:58:10)

    at Object.<anonymous> (E:\project\my\react-native-scanner-qrcode-master\node_modules\react-native\local-cli\util\Config.js:73:20)

    at Module._compile (internal/modules/cjs/loader.js:956:30)

    at Module._compile (E:\project\my\react-native-scanner-qrcode-master\node_modules\pirates\lib\index.js:99:24)

    at Module._extensions..js (internal/modules/cjs/loader.js:973:10)

    at Object.newLoader [as .js] (E:\project\my\react-native-scanner-qrcode-master\node_modules\pirates\lib\index.js:104:7)

    at Module.load (internal/modules/cjs/loader.js:812:32)

    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

 

解决方法:

 

进入node_modules\metro-config\src\defaults 编辑 blacklist.js

 

/node_modules[/\\]react[/\\]dist[/\\].*/ 修改为 /node_modules[\/\\]react[\/\\]dist[\/\\].*/

React Native报错SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/:

上一篇:PHP 正则表达式 详细讲解如何提取两个字符串之间的字符(支持单个&多个)


下一篇:Hibernate JPA中@Transient、@JsonIgnoreProperties、@JsonIgnore、@JsonFormat、@JsonSerialize等注解解释