Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

undefined is not an object (evaluating 'RNFetchBlob.DocumentDir') #350

Closed
zoecarver opened this issue May 7, 2017 · 9 comments
Closed

Comments

@zoecarver
Copy link

First, I have looked at the trouble shooting page of the wiki, however I still cannot fix the problem I am having.

  • RN version:
react-native-cli: 2.0.1
react-native: 0.43.4
  • Here is my code:

import FileUploader from 'react-native-file-uploader'

and

<Button
    onPress={() => RNFetchBlob.fetch('POST', 'http://localhost:8000/upload', {
            'Content-Type' : 'application/octet-stream'
        }, RNFetchBlob.wrap('./tempImageStore/image.jpg'))
    }
    title={'Upload File'}
/>
  • Here is the error I am getting:
    simulator screen shot may 7 2017 11 04 09 am

  • Here is what I did to install react-native-fetch-blob:

    1. npm install --save github:wkh237/react-native-fetch-blob-package#master
    2. react-native link
  • I have tried importing it with both import RNFetchBlob from 'react-native-fetch-blob' and var RNFetchBlob = require('react-native-fetch-blob').default

  • I have tried installing it with the above code and also with npm install --save react-native-fetch-blob

Thank you in advance for your help!

@Anima-t3d
Copy link

Anima-t3d commented May 11, 2017

Seems similar to #30, #51, #84 and #251 but so far none of the suggestions helped. This is on a fresh install with latest react-native 0.44

I did notice that my xcode project did not have any RNFetchBlob references, even though I did npm link

My issues were resolved by simply running RNFB_ANDROID_PERMISSIONS=true react-native link

@MQZhangThu
Copy link

same problem with RN 42.0. Open Xcode and re-build the project, then it is fixed.

@justinmakaila
Copy link

react-native link solved the issue for me

@laurent22
Copy link

I had the same problem on Android and it's because, despite having called npm link multiple times I found that it didn't actually link anything.

I fixed it by following the instructions to manually link there: https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package

Then I've deleted my "android/build" and "android/app/build" folders and ran npm start -- --reset-cache in one terminal and react-native run-android in another. After that it was working fine.

@wkh237 wkh237 closed this as completed Jul 6, 2017
@LA
Copy link

LA commented Oct 4, 2017

I got this error when I was running the dev server of a different app than I was launching.

Took me a couple minutes to figure it out, so maybe this will help someone who tried everything else.

@1c7
Copy link

1c7 commented Jan 3, 2018

image
I am having this problem even with a completely brand new project that created with

react-native init newRN

no idea why

@1c7
Copy link

1c7 commented Jan 3, 2018

image

@1c7
Copy link

1c7 commented Jan 3, 2018

image
oh, now it work, maybe because I haven't close the white window,
and also I run npm uninstall react-native-fetch-blob

now run react-native run-ios
problem gone

@krishan-kumar-mourya
Copy link

After linking you need to run
pod update

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants