“ npx react-native start”挂起

时间:2020-11-07 21:19:21

标签: react-native metro-bundler

简介

我正在尝试使用official docs用React Native 0.63.3创建一个Hello World风格的程序。我正在该链接中使用 React Native CLI Quickstart 路径。

到目前为止我做了什么

我已经到了以下部分:
运行您的React Native应用程序
第1步:启动Metro

我已经跑了:

npx react-native start --verbose

我得到以下输出:

               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          
debug Checking for a newer version of React Native
debug Current version: 0.63.3
debug Cached release version: 0.60.0
debug Checking for newer releases on GitHub
                 Welcome to React Native!
                Learn once, write anywhere



To reload the app press "r"
To open developer menu press "d"

debug Latest release: 0.60.0

按“ r”将显示以下信息:

No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Reloading app...

按“ d”将显示以下信息:

warn No apps connected. Sending "devMenu" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Opening developer menu...

问题

如何成功运行并完成Metro流程,以便我可以运行React Native应用程序?

1 个答案:

答案 0 :(得分:1)

使用npx react-native start,您正在运行构建,但是,要运行该应用程序,则需要选择在androidios上运行。 source:

android:

npx react-native run-android

ios:(mac

npx react-native run-ios