React Native在升级NodeJS新版本后,不能启动开发者服务器报错问题(error Invalid regular expression: /(.*\\__fixtures__\\.*...

NodeJS12.11.0版本以后更新了V8引擎,导致React Native启动 react-native run-android时node服务窗口闪退;同时使用react-native start 终端会报错:

PS D:\Project\myRN> react-native start
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.
_\\.*)$/: Unterminated character class
    at blacklist (D:\Project\myRN\node_modules\metro-config\src\defaults\blacklist.js:34:10)
    at getBlacklistRE (D:\Project\myRN\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:66:59)
    at getDefaultConfig (D:\Project\myRN\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:82:20)
    at load (D:\Project\myRN\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:118:25)
    at Object.runServer [as func] (D:\Project\myRN\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)      
    at Command.handleAction (D:\Project\myRN\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:23)
    at Command.listener (D:\Project\myRN\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:210:5)
    at Command.parseArgs (D:\Project\myRN\node_modules\commander\index.js:651:12)

解决办法:
修改node_modules\metro-config\src\defaults\blacklist.js文件

React Native在升级NodeJS新版本后,不能启动开发者服务器报错问题(error Invalid regular expression: /(.*\\__fixtures__\\.*..._第1张图片
具体代码

官方Issues地址: Changed sharedBlacklist RegExp due to a bug with Node 12.11.0

你可能感兴趣的:(React Native在升级NodeJS新版本后,不能启动开发者服务器报错问题(error Invalid regular expression: /(.*\\__fixtures__\\.*...)