Added react-native-fs to my project and receive an Invariant Violation error. Project is using Expo not sure if this is the issue.
My code:

Error:

I have confirmed that my react-native-fs version is compatible with by react-native version.
Any recommendations?
Seems like your pods didn't install properly try:
cd ios && pod install && cd ..
And try again.
I have the same issue!
I run cd ios && pod install && cd .. but the issue remain
Came across the same issue.
I have missed to update Podfile with following.
pod 'RNFS', :path => '../node_modules/react-native-fs'
Worked fine after doing a pod install. Refer - https://github.com/itinance/react-native-fs#usage-ios
I have the same issue and really hesitate to eject expo to update the Podfile
Updated: We change to use expo file system instead
https://docs.expo.io/versions/latest/sdk/filesystem/
I get this error in testing environment only with Jest. Any solution ?
@ghasemikasra39 I have the same issue!
@ghasemikasra39 I found a solution:
create a __mocks__/react-native-fs.js file in your main directory with the following:
const mockedModule = jest.mock('react-native-fs');
module.exports = mockedModule;
then run npm test and should be fine!
Most helpful comment
@ghasemikasra39 I found a solution:
create a
__mocks__/react-native-fs.jsfile in your main directory with the following:then run npm test and should be fine!