首页 > 解决方案 > “npx react-native start”挂起

问题描述

介绍

我正在尝试使用官方文档创建一个带有 React Native 0.63.3 的 Hello World 风格的程序。我正在使用该链接中的React Native CLI 快速入门路径。

到目前为止我做了什么

我已进入以下部分:
运行您的 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 应用程序?

标签: react-nativemetro-bundler

解决方案


使用npx react-native start,您正在运行构建,但是,要运行应用程序,您需要选择在 onandroid或 on 上运行ios来源:

安卓:

npx react-native run-android

IOS:(苹果电脑)

npx react-native run-ios

推荐阅读