如何在 React Native 中打开现有项目? [英] How to open existing project in React Native?

查看:54
本文介绍了如何在 React Native 中打开现有项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用 React Native 时,我成功地在我的 macbook 上安装了所有用于 iOS 开发的东西,我能够创建一个项目并在手机上查看它.但是,现在我又回到了它,我似乎无法弄清楚如何打开我现有的项目.我曾尝试寻找指南,但我能找到的唯一指南是首次设置.

The first time I used React Native I successfully installed everything to work with iOS development on my macbook and I was able to create a project and view it on a phone. However, now that I'm returning to it I cannot seem to figure out how to open my existing project. I have tried looking for a guide but the only guides I can find are for first time setup.

在我尝试过的终端中:

$ cd MyProjectFolder$ react-native init MyProject

但这似乎想用一个新项目覆盖我的项目.

but this seems to want to overwrite my project with a new one.

我也在尝试:

$ cd MyProjectFolder$ react-native start

这似乎是在正确的轨道上,但我得到的回应是:

This seems like it may be on the right track but the response I get is:

Running packager on port 8081.  

 │                                                                            
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native   


Looking for JS files in
   /Users/User/MyProject 


React packager ready.

Loading dependency graph, done.

这似乎有效,但我无法通过 Expo 与 iPhone 连接,而且我不确定从哪里开始.感觉好像少了一步.

This seems like it's working but I cannot connect with an iPhone via Expo and I'm unsure where to go from here. I feel as though there is a step I'm missing.

推荐答案

我发现了我的错误.我错过的一步是我没有用

I figured out my mistake. The step I was missing was that I had not started the server with

$ npm start

在终端输入以下内容后:

After entering the following in the terminal:

$ cd MyProjectFolder
$ react-native start

我只是在终端中打开第二个选项卡并输入 $ npm start 并且它就像第一次一样加载.

I simply opened a second tab in terminal and entered $ npm start and it loaded up just like the first time.

这篇关于如何在 React Native 中打开现有项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆