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
Expo throwing fs not found error. #408
Comments
Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/408 |
Hi @Haseebshah936 I've transferred the ticket here from the expo test repo. Can you please verify that you have installed react-native-dotenv as a devdependency ? |
@goatandsheep yes I installed it as a dependency. But for now I am not using it. Still if you need any help regrading testing I will be happy to help you |
Thank you for the help! To be clear was it installed as a regular dependency or devdependency? It needs to be installed as a devdependency |
@goatandsheep Running into this issue as well with it installed as a dev dependency. Latest version of expo SDK |
@patrickpistor are you importing react-native-dotenv in your app? Expo will bundle all libraries that are imported whether or not they are installed as devDependency. Also if you are, can you verify that in your Babel that you have set your module name in your babel.config.js to "react-native-dotenv" so it is replaced by Babel with the env object? |
@patrickpistor I stalked your profile and noticed this package.json has react-native-dotenv in the dependencies array not devDependencies https://github.com/Photure/PhotureEthGlobal/blob/master/package.json |
Hey there, I also encountered this error today in a fresh project while following the My setup:Imported it:// index.ts
import {
REACT_NATIVE_SUPABASE_URL,
REACT_NATIVE_SUPABASE_ANON_KEY,
} from "react-native-dotenv"; My types file:// types/env.ds.tsx
declare module "react-native-dotenv" {
export const REACT_NATIVE_SUPABASE_URL: string;
export const REACT_NATIVE_SUPABASE_ANON_KEY: string;
}
const supabaseUrl = REACT_NATIVE_SUPABASE_URL;
const supabaseAnonKey = REACT_NATIVE_SUPABASE_ANON_KEY; My babel.config.js:module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module:react-native-dotenv",
{
moduleName: "react-native-dotenv",
path: ".env",
},
],
],
};
}; Error encountered:iOS Bundling failed 294ms
The package at "node_modules/react-native-dotenv/index.js" attempted to import the Node standard library module "fs".
It failed because the native React runtime does not include the Node standard library. |
Hi @IM-Deane can you please verify in your package.json that |
@goatandsheep that project is dated, this is the one I am using the correct package in the correct place https://github.com/patrickpistor/mixer. The error seems to be around |
I have an open bounty for $45 on Replit if anyone can figure this out: https://replit.com/bounties/@patrickpistor1/create-a-react-nativ |
I didn't see the error regarding fs |
also i have a second expo example here https://github.com/goatandsheep/react-native-dotenv-expo-test |
Thanks @goatandsheep That repo that you made worked. I can give you the bounty if you apply on Replit |
I've applied! :) |
@goatandsheep I accepted you, just submit something and I'll approve it! |
thank you! I uploaded a replit :) |
Error Statement:
The package at "node_modules/react-native-dotenv/index.js" attempted to import the Node standard library module "fs".
It failed because the native React runtime does not include the Node standard library.
Balblel.config
Environment:
Expo sdk ~47.0.12
React native 0.70.5
React 18.1.0
The text was updated successfully, but these errors were encountered: