motdotla/dotenv

dotenv not working in online editors (like Replit)

alainQtec opened this issue · 0 comments

When I start the frontend:

 npm run start

I get:

Module not found: Error: Can't resolve 'fs' in pathto...Node_Modules\dotenv\main.js ..

Note: This error does not happen when running on my local Pc.

Here's the screenshot from running the same app on replit:

image

I conducted a short search and found this answer, which helped me repair issue by modifying the "./node modules/dotenv/Package.json" file.

It worked, the error was fixed!, but I don't understand why ?!😂, so I'm guessing this is a problem that the dotenv community has to fix to avoid hacks like these.