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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN - Unable to resolve module fs from node_modules/dotenv/lib/main.js in 0.2.26 #6758

Closed
nexorianus opened this issue Sep 22, 2020 · 4 comments

Comments

@nexorianus
Copy link

Issue type:

[X] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[X] react-native
[ ] expo

TypeORM version:

[ ] latest
[ ] @next
[X] 0.2.26 (or put your version here)

Steps to reproduce or a small repository showing the problem:

in a react-native app installing and using typeorm at version 0.2.26 results in a crash with metro:

[Tue Sep 22 2020 10:47:30.971]  BUNDLE  ./index.js 

error: Error: Unable to resolve module 'fs' from 'node_modules/dotenv/lib/main.js': fs could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
    at ModuleResolver.resolveDependency (/path/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (/path/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/path/node_modules/metro/src/node-haste/DependencyGraph.js:287:16)
    at Object.resolve (/path/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at /path/node_modules/metro/src/DeltaBundler/traverseDependencies.js:434:31
    at Array.map (<anonymous>)
    at resolveDependencies (/path/node_modules/metro/src/DeltaBundler/traverseDependencies.js:431:18)
    at /path/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/path/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
$ yarn why dotenv
yarn why v1.22.5
[1/4] 🤔  Why do we have the module "dotenv"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "dotenv@6.2.0"
info Reasons this module exists
   - "typeorm" depends on it
   - Hoisted from "typeorm#dotenv"
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "68KB"
info Disk size with transitive dependencies: "68KB"
info Number of shared dependencies: 0
✨  Done in 1.34s.

(in typeorm@0.2.25 i get the error Unable to resolve module urlfromnode_modules/typeorm/browser/util/OrmUtils.js`` wich i wont get in 0.2.26)

I temporary switched back to 0.2.24 what resolves the issues.

My guess is, that a new version of dotenv is requireing the fs moudle, what makes it uncompatible with react-native - what makes typeorm incompatible with RN itself.

@imnotjames
Copy link
Contributor

This is related to #6739

@imnotjames
Copy link
Contributor

@nexorianus has this been fixed in 0.2.27?

@imnotjames
Copy link
Contributor

As far as we can tell - this should be fixed as of the latest release.

@nexorianus
Copy link
Author

sry, didnt work on the app since.
will test tomorrow.

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

No branches or pull requests

2 participants