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

后端 未结 19 2718
说谎
说谎 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:19

    I don't have metro-config in my project, now what?

    I have found that in pretty older project there is no metro-config in node_modules. If it is the case with you, then,

    Go to node_modules/metro-bundler/src/blacklist.js

    And do the same step as mentioned in other answers, i.e.

    Replace

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

    with

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

    P.S. I faced the same situation in a couple of projects so thought sharing it might help someone.

    Edit

    As per comment by @beltrone the file might also exist in,

    node_modules\metro\src\blacklist.js

提交回复
热议问题