react-native-blob-util: TypeError: null is not an object

env os: macOS 10.15.7 mobile device : Motorolla power one, running stock android10 react-native-blob-util version: 0.13.7 react-native: 0.61.5

AndroidManifest.xml

...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
....
<application
    ...
    android:requestLegacyExternalStorage="true"
>
...

code

import ReactNativeBlobUtil from 'react-native-blob-util'


const tempImageUri = await ReactNativeBlobUtil.config({ fileCache: true }).fetch(`${image_url}`)

error

TypeError : null is not an object (evaluating 'ReactNativeBlobUtil.DocumentDir')

Any idea where I might be going wrong?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 23 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@CoreyBovalina If you’re using yarn then can you try this?

  1. Add this to package.json

    "resolutions": {
        "react-native-blob-util": "0.13.17"
    },
  1. Add react-native-blob-util@0.13.17 as a dependency
  2. Delete node_modules and run yarn install again

“react-native-blob-util”: “0.13.17”

in addition to doing having it as an added package as well?

when I tried doing this and it didn’t fix it before: yarn add react-native-pdf react-native-blob-util fbjs

I fixed sth that could cause it, so probably you got that fix now. I’m glad it’s now working for you

  • Delete node_modules folder (or make sure to delete rn-ftech-blob)
  • Install react-native-blob-util as a standard dependency for your project That’s all, it should work. It sounds like your app is trying to find the library within of react-native-pdf. But there it won’t be installed

are you using expo or a plain simple react-native project?

in my case this is not an expo project, it is a plain simple react-native project