2
react native version 63.4 
node version 14.17.5

Error: Unable to resolve module util from D:\Repos\Socket\node_modules\bson\dist\bson.browser.umd.js: util 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 and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

var customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' ? // eslint-disable-line dot-notation Symbol'for' // eslint-disable-line dot-notation ^ : null;

I installed new version of the npm and after run npx react-native run-andorid getting this issue.

1 Answer 1

2

The solution is to run this command and it will be fixed

npm install util

4
  • can you clarify how this solves the issue? we are seeing this issue happen in our CI environment, but locally our react-native builds/runs android without issue Commented Aug 24, 2021 at 14:41
  • I have copied the file from my running project to the project that was causing issue. and it solved my problem. Commented Aug 25, 2021 at 5:01
  • @AftabAmin if my answer fixes your issue please mark it as the answer.
    – Musab.BA
    Commented Aug 25, 2021 at 9:58
  • 1
    I will check this, and if solves my issue. then will definite mark it as accepted and will upvote it. Commented Aug 25, 2021 at 10:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.