简体   繁体   English

如何在React Native中打开现有项目?

[英]How to open existing project in React Native?

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. 我第一次使用React Native我成功地安装了所有内容以便在我的macbook上使用iOS开发,我能够创建一个项目并在手机上查看它。 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. 我曾尝试寻找指南,但我能找到的唯一指南是第一次设置。

In the terminal I have tried: 在终端我尝试过:

$ cd MyProjectFolder $ react-native init MyProject

but this seems to want to overwrite my project with a new one. 但这似乎想要用一个新项目覆盖我的项目。

I am also trying: 我也在尝试:

$ 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.

This seems like it's working but I cannot connect with an iPhone via Expo and I'm unsure where to go from here. 这似乎有效但我无法通过世博会与iPhone连接,我不确定从哪里开始。 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

I simply opened a second tab in terminal and entered $ npm start and it loaded up just like the first time. 我只是在终端打开第二个标签并输入$ npm start ,它就像第一次一样加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM