美文网首页
React Native在升级NodeJS新版本后,不能启动开发

React Native在升级NodeJS新版本后,不能启动开发

作者: 疯狂艺人 | 来源:发表于2019-10-27 23:18 被阅读0次

    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文件

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

    相关文章

      网友评论

          本文标题:React Native在升级NodeJS新版本后,不能启动开发

          本文链接:https://www.haomeiwen.com/subject/ifzmvctx.html