javascript - 如何运行现有的 react native 项目

标签 javascript android windows react-native npm

我想下载并运行别人的项目以考虑其功能。我遇到了一些问题......它无法启动,我只是不知道该怎么做,请帮助

https://github.com/sunlight3d/react_native_v0.49/tree/master/61-Realm%20React%20Native%235.Filter%20data%20and%20working%20with%20To-Many%20Relationships/code/tutorialProject

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

2)打开VS代码

3)进入工作文件夹并点击在cmd文件夹教程项目中打开

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

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 init MyProject
5) react-native init tutorialProject并获得更紧密的正确线

我尝试通过 npm 启动服务器然后很有趣...
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

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

最佳答案

当你下载后需要安装package.json中的所有包

npm install --save

那么你需要启动另一个终端
npm start -- --reset-cache / npm start / react-native start 

用于启动您的 bundler

最后你可以运行你的项目
react-native run-android 

关于javascript - 如何运行现有的 react native 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55714819/

相关文章:

javascript - 表单验证中的文本输出跑出输出消息框

java - 在 Android 设备上将视频转换为音频 (Java)

windows - 您如何获得 Windows 视频驱动程序的版本?

windows - Vim:\n 与\r

javascript - 创建可点击的进度条

javascript - 使用纯 jquery 进行 firebase 匿名身份验证

android - 是否可以从 Assets 文件中获取最后修改日期?

C++ 窗口时间

javascript - 使用日期选择器禁用今天之前的日期

Android:使用 notifyDataSetChanged 和 getLastVisiblePosition - 当 listView 实际更新时?