Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: null is not an object #33

Closed
davepaiva opened this issue May 15, 2021 · 23 comments
Closed

TypeError: null is not an object #33

davepaiva opened this issue May 15, 2021 · 23 comments
Labels
bug Something isn't working

Comments

@davepaiva
Copy link

davepaiva commented May 15, 2021

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?

@GuilhermeBergamoBR
Copy link

Same thing here, any progress?

@RonRadtke
Copy link
Owner

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

@GuilhermeBergamoBR
Copy link

It is an expo based project, but I already ejected

@davepaiva
Copy link
Author

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

@imranMnts
Copy link

@RonRadtke Do we have any update?
I have the same issue and I'm using it in a React native CLI 0.63.4 project

@RonRadtke
Copy link
Owner

Sadly not. So far I am still failing in reproducing the problem on my devices / machines.
Using it myself with RN 63.3 in production, so I doubt it's the RN version...
It's also working fine on a new project for me

Could you please try to run a gradlew clean and also clean npm modules / reinstall them?

It sounds like something is off when trying to load the reacht-native-blob-util.

@RonRadtke RonRadtke added the bug Something isn't working label Aug 1, 2021
@RonRadtke
Copy link
Owner

I actually managed to get this error now once too.
But I could find any reason for it. Resetting the build caches and reinstalling the NPM modules solved it for me.

@arunim2405
Copy link

@RonRadtke I am still facing this issue, reinstalling node_modules did not work for me, even tried npm start -- --reset-cache

@DonBranson
Copy link

@RonRadtke I am still facing this issue, reinstalling node_modules did not work for me, even tried npm start -- --reset-cache

I was facing this problem with RN65, redux-persist-filesystem-storage 4.0.0, which uses react-native-blob-util 0.13.12. Manually removing 0.13.12 and yarn add react-native-blob-util installed 0.13.16, which fixed this problem for me.

@RonRadtke
Copy link
Owner

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

@anujmpec
Copy link

I am facing issue in it "react-native-blob-util": "^0.13.16",
inside "react-native-pdf": "^6.4.0",
"react-native": "0.63.4",

@ahmed-ismail-nt
Copy link

ahmed-ismail-nt commented Nov 16, 2021

This package is a dependency of redux-persist-filesystem-storage. Force upgrading the nested dependency to 0.13.17 allowed the app to start without errors.

Thank you!

Edit: This is based on the advice above that version 0.13.16 resolves the problem. I just went ahead with the latest version instead ;)

@CoreyBovalina
Copy link

I'm also having the same issue with react-native-pdf 6.4 since they switch to react-native-blob-util from rn-fetch-blob. Any way to fix this? I've added the latest react-native-blob-util and still broke.

alburdette619 pushed a commit to alburdette619/redux-persist-filesystem-storage that referenced this issue Nov 16, 2021
According to [a blob-util issue](RonRadtke/react-native-blob-util#33), this will fix the crash I'm seeing due to this library's upgrade.
@ahmed-ismail-nt
Copy link

@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

@CoreyBovalina
Copy link

CoreyBovalina commented Nov 16, 2021

"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

@CoreyBovalina
Copy link

CoreyBovalina commented Nov 16, 2021

ok I tried with what you said and I get this:
error: Error: Unable to resolve module react-native-blob-util from /Users/Corey/Code/aaa/qqq/node_modules/react-native-pdf/index.js: react-native-blob-util could not be found within the project or in these directories: node_modules/react-native-pdf/node_modules node_modules ../node_modules

@aaron-dsilva-opsfuse
Copy link

aaron-dsilva-opsfuse commented Nov 18, 2021

Facing this issues on react native: "0.66.1"
react-native-blob-util: "0.13.17".
Not working on ios

@RonRadtke
Copy link
Owner

  • 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

@silverax
Copy link

Got the same issue here, I'm trying to use react-native-pdf.
I tried adding direct dependencies to react-native-blob-util versions .16, .17 and .18 to no avail
image

@SzymonGlab
Copy link

SzymonGlab commented Jan 25, 2022

Same problem, updated react-native-pdf to newest version and according to their docs I installed react-native-blob-util - version 0.13.18.

Android works fine but on iOS I get this error mentioned in the question:
TypeError: null is not an object (evaluating 'ReactNativeBlobUtil.DocumentDir').

edit: Problem disappeared after updating RN to 0.67.1

@chadzxrex
Copy link

chadzxrex commented Mar 25, 2022

For those who still face this issue, make sure you have linked the library in Podfile, and run npx pod-install again after linking it.
pod 'react-native-blob-util', :path => '../node_modules/react-native-blob-util'

@yingwei1025
Copy link

Facing this same issues on
react native: "0.68.2"
react-native-pdf: "6.5.0",
react-native-blob-util: "0.13.18".
expo: "45.0.0"

how to make it work on expo

@RonRadtke
Copy link
Owner

Facing this same issues on react native: "0.68.2" react-native-pdf: "6.5.0", react-native-blob-util: "0.13.18". expo: "45.0.0"

how to make it work on expo

You would have to eject your project since we are using native components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests