2015-06-10 99 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這表明它確實現在工作。