react-native-fs: cannot read property of RNFSFileTypeRegular of undefined

Hi all,

i am having issues using this module in an ios project. The Error occurs inside the module, therefore i assume, some dependencies // linkages are incorrect? in FS.common.js this line of code throws the error ‘cannot read property of RNFSFileTypeRegular of undefined’

var RNFSFileTypeRegular = RNFSManager.RNFSFileTypeRegular;

Meaning that RNFSManager is undefined. How is this possible? RNFSManager is created here : var RNFSManager = require('react-native').NativeModules.RNFSManager;

I guess, NativeModules does not have the RNFSManager included wich is the reason for this error. Does anyone know, how to fix this?

( works properly in android - must be an ios only issue ?)

i am using react-native-cli: 1.0.0 react-native: 0.35.0

thnx for any help on that!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 7
  • Comments: 30

Most upvoted comments

re-run react-native run-android or react-native run-ios

You fix the bug by reading and following the instructions correctly 😄

Seriously, I hit the error, and found out I skipped a step in the setup.

This issue is still present on RN 0.41 / iOS (android works)

I’ve tested both 2.0.1-rc.2 and 2.1.0-rc.1:

  • automatic link seems to goes through all steps, but still shows the error
  • manual link does not work either

We’re on xcode 7.3.1

@ruler47 @Thibaut-Fatus well, guys, I believe you should rebuild your Xcode project running react-native run-ios. This resolved my issue yesterday without manual linking and the stuff.

I had this issue on Android, and it was because I didn’t link the module properly.

re-run react-native run-android or react-native run-ios

Works.

I am also facing this issue. My tool set is same as @Thibaut-Fatus use.

@BG687 I was having the same issue. What worked for me was to build the debug scheme in XCode, then retry using react-native run-ios.

Same here as @Xing-He - I followed the instructions and the react-native link did not add the XCode project or the linked binary. I had to manually do it. Problem solved.

automatically link doesn’t add RNFS to my project, i add it manually to resolve this issue!

I don’t know why this fixed it but I removed libRNFS.a from Link Binary with Libraries and re-added it and now it’s working… go figure…

I had also this error on my Android emulator but it was because I did not restart gradle build (with react-native run-android). It worked without manual configuration but with react-native link.

R.N 0.42 Ubuntu 16.10 64 bits