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

error: Error: Unable to resolve module ../../../../../src/util from node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js: #535

Open
justankit opened this issue Apr 5, 2024 · 3 comments

Comments

@justankit
Copy link

Hi,

Please help me to fix this error. This dependency is being used as a sub-dependency of react-native-crypto.

error: Error: Unable to resolve module ../../../../../src/util from node_modules/browserify-sign/node_modules/readable-stream/lib/_stream_readable.js:

None of these files exist:

src/util(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
src/util/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
1 | // Copyright Joyent, Inc. and other Node contributors.
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the
at ModuleResolver.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
at DependencyGraph.resolveDependency (node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at Object.resolve (node_modules/metro/src/lib/transformHelpers.js:129:24)
at resolve (node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
at node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
at Array.reduce ()
at resolveDependencies (node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
at processModule (node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
at async addDependency (node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
at async Promise.all (index 0)

@rluvaton
Copy link
Member

rluvaton commented Apr 6, 2024

Hey, please provide minimal reproduction so we can better help

@justankit
Copy link
Author

Hi @rluvaton

Followed these steps in react native app:

npm i --save react-native-crypto

install peer deps

npm i --save react-native-randombytes
react-native link react-native-randombytes

install latest rn-nodeify

npm i --save-dev tradle/rn-nodeify

install node core shims and recursively hack package.json files

in ./node_modules to add/update the "browser"/"react-native" field with relevant mappings

./node_modules/.bin/rn-nodeify --hack --install

rn-nodeify will create a shim.js in the project root directory
// index.ios.js or index.android.js
// make sure you use import and not require!
import './shim.js'
import crypto from 'crypto'
// ...the rest of your code

React and React Native Details:

"react": "17.0.2",
react-native": "0.68.6",

@mcollina
Copy link
Member

mcollina commented Apr 7, 2024

Unfortunately I know nothing on React Native, so if you create a repository that fails a command it would be helpful.

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

No branches or pull requests

3 participants