promise – can't find variable process

2.5k views Asked by At

for my (first) react-native project I use the Node module react-native-refreshable-listview requiring a CommonJS/A+ promise method to display an indicator. However, everytime the promise's then method is invoked by the consumer (for example this.doSomething().then(function() { ... })) I get the following error:

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

I have already read this question, but I could not fix the issue. Although the component ControlledListView can be used for circumventing this error, I like the promise concept very much and I plan to use some more in my application.

I am using react-native version 0.6.0 rc1 as well as iOS 8.3.

I appreciate any help. Thanks in advance!

1

There are 1 answers

0
Colin Ramsay On BEST ANSWER

You're trying to use a Promises library that's designed for NodeJS, and it's trying to load a dependency called process that isn't available in React Native.

Try another promises library like Bluebird as that's more likely to work with React Native; see this issue which indicates that it does indeed now work.