How to resolve the error on 'react-native start'

后端 未结 19 2652
说谎
说谎 2020-11-29 15:41
  1. I just installed node.js & cli

    • installed node.js
    • installed react-native-cli

      npm -g react-native-cli
      
19条回答
  •  离开以前
    2020-11-29 16:24

    This is caused by node v12.11.0 due to the way it deals regular location there two ways to solve this problem

    Method I

    You can downgrade to node v12.10.0 this will apply the correct way to deal with parsing error

    Method II

    You can correctly terminate the regular expression in you case by changing the file located a:

    \node_modules\metro-config\src\defaults\blacklist.js

    From:

    var sharedBlacklist = [
      /node_modules[/\\]react[/\\]dist[/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    

    To:

     var sharedBlacklist = [
      /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    

提交回复
热议问题