I am doing an online course about React-Native and Firebase but I came across an error.
Here it is : Error: Unable to resolve module fs from Documents/code/ChatApp/node_modules/react-native-dotenv/index.js:
I’ve seen responses that fs is not available on react-native, is that true ?
Why install a package so that in the end it can’t be used?
thank you in advance for your answers
3
Answers
No, fs is not available in React Native. You can use the react-native-fs package instead.
https://github.com/itinance/react-native-fs
That online course might be referring to old version of
react-native-dotenv
. To make it work with the new version, make these minor changes to your code as explained in this wiki. No need to installfs
.change it to
module:react-native-dotenv
is present inbabel.config.js
file. Example –react-native-dotenv
author here: reinstall the library as a dev dependency