Error: Unable to resolve module `fs` from `dotenv`

See original GitHub issue

Hello, I followed the steps to install v3.3.1 to a fresh expo v45.0.0 project and I am getting a build error. I have configured my babel.config.js as the instructions show, and used the @env import. I looked through yarn.lock and found this package has a dependency of dotenv ^10.0.0, perhaps this dependency is the issue? Build error below:

iOS Bundling failed 127ms
Unable to resolve module fs from /.../app/node_modules/dotenv/lib/main.js: fs could not be found within the project or in these directories:
  node_modules
  22 | */
  23 |
> 24 | const fs = require('fs')
     |                     ^
  25 | const path = require('path')
  26 | const os = require('os')

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
nicodescommented, Jul 9, 2022

Never mind, solved my issues with a sip of coffee 🤪

2reactions
CodingMeSwiftlycommented, Nov 4, 2022

Never mind, solved my issues with a sip of coffee 🤪

A special place in hell is reserved for people like you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve module 'fs' from 'node_modules/react-native ...
I just found the new update of this package. And wanted to update it in order to keep my project up to date....
Read more >
Unable to resolve module fs - react-native-dotenv
I am doing an online course about React-Native and Firebase but I came across an error. Here it ...
Read more >
Cannot find module 'dotenv' error in Node.js | bobbyhadz
To solve the error "Cannot find module 'dotenv'", make sure to install the dotenv package by opening your terminal in your project's root...
Read more >
can't resolve 'fs' in dotenv react - You.com | The AI Search ...
The reason you are running into this error is because dotenv is meant to be used in Node.js, not in the browser. If...
Read more >
can't resolve 'fs' in dotenv - Autoinfo
Module not found: Error: Can't resolve 'fs' in dotenv - upgrading to react 17 Tibo Asked 10 months ago 0 4 answers Well,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found