[BABEL]: Cannot find module 'node:fs'
iGroza opened this issue ยท 18 comments
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.
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
I am also facing the same issue
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.
same issue
Please confirm that you installed as a dev dependency not prod dependency
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
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.
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.
Same issue here and it was installed as a DEV dependency.
Ok I will reverse the change as it seems to be a bug not usage issue
I have reverted this in 3.4.7 . Please let me know if the issue persists.