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)

扫描二维码关注公众号,回复: 11274667 查看本文章

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

猜你喜欢

转载自www.cnblogs.com/bugDevelopment/p/12968407.html