8

Disclaimer

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

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'}
/>

Error I am getting:

simulator screen shot may 7 2017 11 04 09 am

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

Background info:

  • 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
  • I am trying this on the IOS emulator.

Thank you in advance for your help!

2
  • hey thanks for the question. but how did you make it work with cocopod please? Commented Aug 14, 2017 at 15:17
  • The problem is with react-native link command. It is not linking the RNFetchBlob. Follow these instructions to fix it: github.com/wkh237/react-native-fetch-blob/wiki/… Commented Apr 23, 2018 at 20:42

5 Answers 5

5

After linking you need to run

pod update

inside ios folder

Sign up to request clarification or add additional context in comments.

Comments

2
+50

So it looks like the module isn't importing. Obvious I know, I can only think of a few things to help seeing as that project looks fairly popular and stable.

I noticed that you're requiring 'react-native-file-uploader' but using 'react-native-fetch-blob'. I'm assuming this is a mistake. You could also try, if you haven't:

var RNFetchBlob = require('react-native-fetch-blob')

Now assuming you're correctly importing it, try one of the following and then restart x-code:

  1. If you haven't already restart the packager. I recall having to restart the packager every time I installed a new module.

  2. If that doesn't work, try installing deleting it from your node modules (just to be safe) and installing with cocoa pods which will handle all of the linking for you.

5 Comments

I re-built the project and used cocoa pods. This worked. Thank you for the help, I will award you the 50 points in a day or two if no one else submits something that works better. Thank you again for the help.
Sure, no problem. I do think it should work without cocoapods but can't offer an explaination as to why it doesn't without dig much much deeper.
@zoecarver I understand that in order to install with cocoa pods you add the package to podfile, right? How do you do it?
@klvs Why did you write 'try installing/deleting'? Not just deleting by npm/yarn and installing with cocoa pods?
And one more thing: why is it required to install this package with cocoa pods while the others are installed with npm/yarn?
2

If you are using React Native >= V.060 nothing to do

If you are using React Native <= 0.59

Check this link : https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package

Comments

0

Is part 2 of the installation actually

react-native link

? I think it should be

react-native link github:wkh237/react-native-fetch-blob-package#master

1 Comment

i am facing same error on android. Were you able to run on android? I tried almost all solution but it didn't worked. please let me know if it working for you.
0

first it has changed to rn-fetch-blob https://github.com/joltup/rn-fetch-blob

then when you install it then Do the linking manually, it worked for me

https://github.com/joltup/rn-fetch-blob/wiki/Manually-Link-Package

1 Comment

A link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.