Home > OS >  react-native-fs not working on react-native version 0.69
react-native-fs not working on react-native version 0.69

Time:10-18

I am using react-native version 0.69 and I want to read a file stored in assets in my react native project. using following syntax in App.js

import fs from 'react-native-fs';

I have installed 'react-native-fs' and followed all the links I could find on the internet but I am still getting below error while running the app.

ERROR  TypeError: null is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
 * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current 
project.
 * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

I tried to run react-native link react-nativs-fs but link support has been removed in react-native >= 60 as mentioned in official docs, I am unable to get this to work, any help would be appreciated. I have seen similar issues on the stackoverflow but none has given the answer for react native >=0.60 versions

Also I am using expo to create the app. my OS is Windows 10 64 bit.

CodePudding user response:

react-native-fs is not supported with Expo but it is only supported by Pure React Native.

Expo has a package that offers filesystem support: expo-file-system

  • Related