【问题标题】:react native run-ios or run-android error反应原生 run-ios 或 run-android 错误
【发布时间】:2016-07-26 02:21:38
【问题描述】:

我正在尝试使用这个项目

https://github.com/FaridSafi/react-native-gifted-listview

我会写下订单处理。

  1. 下载project.zip并解压

  2. 在终端中,我使用了这个命令 [npm install]

  3. 还有这个 [react-native run-android] & [react-native run-ios]

但我未能构建这个项目。

open-ui-iMac:react-native-gifted-listview-master openobject$ react-native run-android 未找到 Android 项目。也许先运行 react-native android?

open-ui-iMac:react-native-gifted-listview-master openobject$ react-native run-ios /Users/openobject/practice/react-native-gifted-listview-master/node_modules/promise/lib/done.js:10 抛出错误; ^

错误:ENOENT:没有这样的文件或目录,uv_chdir

at Error (native)
at process.chdir (/Users/openobject/practice/react-native-gifted-listview-master/node_modules/graceful-fs/polyfills.js:18:9)
at _runIOS (node_modules/react-native/local-cli/runIOS/runIOS.js:50:11)
at node_modules/react-native/local-cli/runIOS/runIOS.js:24:5
at tryCallTwo (/Users/openobject/practice/react-native-gifted-listview-master/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/openobject/practice/react-native-gifted-listview-master/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/openobject/practice/react-native-gifted-listview-master/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (node_modules/react-native/local-cli/runIOS/runIOS.js:23:10)
at Object.run (node_modules/react-native/local-cli/cliEntry.js:95:3)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)

我找到了一些解决方案。

他们说“使用这个命令”

rm -rf 节点模块

rm -fr $TMPDIR/react-*

守望者手表-del-all

npm install --save react-native@latest

但它无法解决这个问题

我该如何解决这个问题?

【问题讨论】:

  • 步骤不清楚。在下载这个项目之前你有react-native 项目吗?请注意,这不是一个完整的 react-native 项目。这是一个Component,可以安装到react-native's项目以显示listview。
  • 那么,我只是把这个文件夹放在项目文件夹中?我会试试这个。谢谢
  • 不。那是行不通的。我将发布有关如何正确执行此操作的步骤。
  • 哦,谢谢!我真的很困惑构建 react-native 项目。
  • 试试 gradlew clean

标签: reactjs npm react-native


【解决方案1】:

您正在尝试在您的项目中使用第 3 方 React Native 组件。正确安装和使用组件的方法如下:

  1. 进入您的react-native 项目:cd yourProject
  2. 在您的终端上运行以下代码:npm install react-native-gifted-listview --save。这是安装组件的方法。 npm install component-name --save

  3. 在您要使用的页面中导入已安装的组件:import GiftedListView from 'react-native-gifted-listview';

  4. 现在可以使用组件了:

<GiftedListView
  rowView={this._renderRowView}
  onFetch={this._onFetch}
  firstLoader={true} 
  pagination={true} 
  refreshable={true} 
  withSections={false}
  refreshableTintColor="blue"
/>

【讨论】:

  • 天哪。这是完美的工作。真的真的谢谢你!谢谢你成为学到很多东西。
猜你喜欢
  • 1970-01-01
  • 2019-01-25
  • 1970-01-01
  • 2018-02-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多