如何运行React Native的现有项目 [英] how to run an existing project of react native

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

问题描述

我想下载并运行其他人的项目以考虑其功能.我遇到了很多问题...开始时并不容易,我只是不知道该怎么办,请帮忙

I wanted to download and run someone else's project in order to consider its functions. I ran into a number of problems ... that it does not deign to start, and I just don’t know what to do, help, please

1)复制到工作文件夹教程项目

1) copied to the working folder tutorial project

2)打开VS代码

3)进入工作文件夹,然后在cmd文件夹教程项目中单击打开"

3) went into the working folder and clicked open in cmd folder tutorial project

4)然后我输入 react-native run-android 并惨败

4) then I enter react-native run-android and get fiasco

d:\JS\tutorialProject>react-native init tutorialProject
 internal/modules/cjs/loader.js:657 throw err; ^

 Error: Cannot find module 'graceful-fs' at
 Function.Module._resolveFilename
 (internal/modules/cjs/loader.js:655:15) at Function.Module._load
 (internal/modules/cjs/loader.js:580:25) at Module.require
 (internal/modules/cjs/loader.js:711:19) at require
 (internal/modules/cjs/helpers.js:14:16) at Object.<anonymous>
 (d:\JS\tutorialProject\node_modules\react-native\local-cli\cli.js:12:1)
 at Module._compile (internal/modules/cjs/loader.js:805:30) at
 Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
 at Module.load (internal/modules/cjs/loader.js:672:32) at
 tryModuleLoad (internal/modules/cjs/loader.js:612:12) at
 Function.Module._load (internal/modules/cjs/loader.js:604:3)

我开始谷歌搜索,发现与某些依赖项有关.使用 react-native初始MyProject

I started googling and found something to do with some dependencies. Using react-native init MyProject

5) react-native初始tutorialProject 并获得更紧的对角线

5) react-native init tutorialProject and getting the tighter right line

我尝试通过 npm 启动服务器,这很有趣...6) npm-intall

I try to start the server through npm and then it's funny ... 6) npm-intall

d:\JS\tutorialProject>npm install npm WARN deprecated core-js@1.2.7:
 core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3
 or at least to actual version of core-js@2. npm WARN deprecated
 connect@2.30.2: connect 2.x series is deprecated npm ERR! path
 d:\JS\tutorialProject\node_modules\.bin\react-native npm ERR! code
 EEXIST npm ERR! Refusing to delete
 d:\JS\tutorialProject\node_modules\.bin\react-native: is outside
 d:\JS\tutorialProject\node_modules\react-native and not a link npm
 ERR! File exists: d:\JS\tutorialProject\node_modules\.bin\react-native
 npm ERR! Move it away, and try again.

 npm ERR! A complete log of this run can be found in: npm ERR!
 C:\Users\Nick\AppData\Roaming\npm-cache\_logs\2019-04-16T18_15_13_614Z-debug.log

在这里,我绝对不知道.如何运行别人的项目?

and here I am absolutely don't know. How to run someone else's project?

推荐答案

下载后,需要将所有软件包安装在 package.json

When you download after you need to install all package in package.json

npm install --save

然后您需要启动另一个终端

then you need to start another terminal

npm start -- --reset-cache / npm start / react-native start 

用于启动捆绑器

最终您可以运行您的项目

finally you can run your project

react-native run-android 

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

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