Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BABEL]: Cannot find module 'node:fs' #392

Closed
iGroza opened this issue Dec 8, 2022 · 11 comments 路 Fixed by #399
Closed

[BABEL]: Cannot find module 'node:fs' #392

iGroza opened this issue Dec 8, 2022 · 11 comments 路 Fixed by #399

Comments

@iGroza
Copy link

iGroza commented Dec 8, 2022

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-native-dotenv@3.4.6 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-dotenv/index.js b/node_modules/react-native-dotenv/index.js
index 148baba..5086059 100644
--- a/node_modules/react-native-dotenv/index.js
+++ b/node_modules/react-native-dotenv/index.js
@@ -1,5 +1,5 @@
-const {readFileSync, statSync} = require('node:fs')
-const path = require('node:path')
+const {readFileSync, statSync} = require('fs')
+const path = require('path')
 const dotenv = require('dotenv')
 
 function parseDotenvFile(path, verbose = false) {

This issue body was partially generated by patch-package.

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

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/392

@Muthu011
Copy link

Muthu011 commented Dec 9, 2022

I am also facing the same issue

@goatandsheep
Copy link
Owner

goatandsheep commented Dec 22, 2022

Hi I made this change recently on purpose. Please do not use this library as a production dependency. Use it as a dev dependency. The library is not broken.

@subhadeepquantiantech
Copy link

same issue

@goatandsheep
Copy link
Owner

goatandsheep commented Dec 30, 2022

Please confirm that you installed as a dev dependency not prod dependency

@goatandsheep
Copy link
Owner

Some folks here are saying that making it devDependency is not fixing it. I suppose it could be because of the recent change from fs to node:fs and path to node:path but I'm not sure why and I'm not sure if there's another answer we're overlooking

@goatandsheep
Copy link
Owner

Ok I have an idea now of what the issue might be. node:fs is a feature of node >18.x . Since LTS versions of 14.x and 16.x are still in maintenance, I will revert this as long as someone can identify that upgrading their node version fixes the issue. I will create a draft PR for now.

@ArtyEmsee
Copy link

I'm also seeing this on a new project-- node version is 18.12.1 LTS and seeing the same error regardless of prod v dev dependency injection.

@knro
Copy link

knro commented Jan 3, 2023

Same issue here and it was installed as a DEV dependency.

@goatandsheep
Copy link
Owner

Ok I will reverse the change as it seems to be a bug not usage issue

goatandsheep added a commit that referenced this issue Jan 4, 2023
@goatandsheep
Copy link
Owner

I have reverted this in 3.4.7 . Please let me know if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants