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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM