2015-06-10 58 views
2

我的(第一)react-native项目我使用Node模块react-native-refreshable-listview需要CommonJS/A +承诺方法来显示一个指标。然而,每次承诺的then方法由消费者(例如this.doSomething().then(function() { ... }))我收到以下错误调用:承诺 - 无法找到变量进程

Error: Can't find variable: process 
stack: 
    requestFlush      index.ios.bundle:43767 
    rawAsap       index.ios.bundle:43709 
    handle       index.ios.bundle:43602 
    finale       index.ios.bundle:43661 
    resolve       index.ios.bundle:43651 
    <unknown>       index.ios.bundle:43683 
    <unknown>       index.ios.bundle:42446 
    notifyAll       index.ios.bundle:4880 
    close        index.ios.bundle:4597 
    closeAll       index.ios.bundle:6174 
    perform       index.ios.bundle:6115 
    perform       index.ios.bundle:4629 
    flushBatchedUpdates    index.ios.bundle:4709 
    ReactUpdates_flushBatchedUpdates index.ios.bundle:4978 
    closeAll       index.ios.bundle:6174 
    perform       index.ios.bundle:6115 
    batchedUpdates     index.ios.bundle:13822 
    batchedUpdates     index.ios.bundle:4644 
    <unknown>       index.ios.bundle:7567 
    applyWithErrorReporter   index.ios.bundle:7314 
    guardReturn      index.ios.bundle:7336 
    processBatch      index.ios.bundle:7566 
URL: http://192.168.16.250:8081/index.ios.bundle 
line: 43767 
message: Can't find variable: process 

我已经看过this question,但我无法修复该问题。 尽管组件ControlledListView可用于规避此错误,但我非常喜欢诺言概念,并计划在我的应用程序中使用更多。

我正在使用react-native版本0.6.0 rc1以及iOS 8.3。

我很感激任何帮助。提前致谢!

+0

您使用的是承诺库吗?哪一个? –

+0

是的,我使用[本网站](https://www.promisejs.org/)建议的'promise'库('NodeJS'节) – Lukas

回答

1

您正在尝试使用专为NodeJS设计的Promises库,它试图加载名为process的依赖关系,这在React Native中不可用。

尝试其他承诺库,如Bluebird,因为这更有可能与React Native配合使用;见this issue这表明它确实现在工作。