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 process #63

Open
forge-phap-dinh opened this issue Nov 10, 2021 · 2 comments
Open

error: Error: Unable to resolve module process #63

forge-phap-dinh opened this issue Nov 10, 2021 · 2 comments

Comments

@forge-phap-dinh
Copy link

I am using react native 0.66 and after I import the shim file and run the app I get this error

error: Error: Unable to resolve module process ...

process could not be found within the project or in these directories:
node_modules

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*
    1 | if (typeof __dirname === 'undefined') global.__dirname = '/'
    2 | if (typeof __filename === 'undefined') global.__filename = ''

3 | if (typeof process === 'undefined') {
| ^
4 | global.process = require('process')
5 | } else {
6 | const bProcess = require('process')

@walkstreet
Copy link

I got the same problem.

@walkstreet
Copy link

yarn add react-native-crypto
# install peer deps
yarn add react-native-randombytes
npx react-native link react-native-randombytes
# on RN >= 0.60, instead do:
cd iOS && pod install
# install latest rn-nodeify
yarn add 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
npx rn-nodeify --install buffer,crypto,stream,util,process,vm --hack

Maybe I've got the answer. You can follow these steps to work it out.

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

2 participants