0

This is now a problem I've been dealing with for a long long time and it has become an annoyance, so I would appreciate any kind of help.

I have been working on a react-native project with my team and everything was fine until I decided to relocate the project on my Mac and clone the repo from GitHub to my new location (I am not able to share the repo since it's private). Since then, when I run the npm run android / ios I run into the following error:

Screenshot of the error screen

I am able to start the app on the emulator by running npx react-native start and opening the app even after getting the error, so as I understand, it builds the app but fails to start it. However this means whenever I need a new build, I need to run a command, receive an error, run another command and open the app manually. Also, I am not able to create a build for my real iOS device at all.

I have tried deleting and reinstalling packages, clearing cache from watchman, react-native and metro bundler, reinstalling react-native-cli with --force, basically I have tried every solution I could find on StackOverflow related to my problem. Here are some solutions I found:

React-Native Bundle Error error SHA-1 for file is not computed

react native bundle sha-1 for file not computed(unable to load script from assets index.android.bundle)

How to remove error: bundling failed: ReferenceError: SHA-1 for file is not computed

react-native metro bundler error: bundling failed: ReferenceError: SHA-1 for file

Sadly, none of these worked for me. How can I solve this problem?

System:

  • macOS 11.1

Binaries:

  • Node: 14.15.3
  • npm: 6.14.9
  • Watchman: 4.9.0

npmPackages:

  • @react-native-community/cli: Not Found
  • react: 16.11.0
  • react-native: 0.62.2

Thanks in advance.

Ece Mac
  • 61
  • 1
  • 10
  • Would you be able to share your RN versions, etc..? Simply execute `react-native info` at your project root folder and share the output. – Tommy Leong Jan 21 '21 at 09:07
  • Also, it seems that quite some number of developers has resolve similar issue with [this solution](https://github.com/facebook/metro/issues/330#issuecomment-572917876) – Tommy Leong Jan 21 '21 at 09:10
  • @TommyLeong I've provided the versions and now I'm noticing react-native-community/cli is missing. This might cause the problem. – Ece Mac Jan 21 '21 at 11:28
  • Glad you found out the solution!! if my suggestion helps you, you may give a tick to my answer. (: – Tommy Leong Jan 22 '21 at 01:46

1 Answers1

0

Issue should fixed by installing react-native-cli:

  1. yarn global remove react-native
  2. yarn global add react-native-cli

Credits source

Tommy Leong
  • 2,509
  • 6
  • 30
  • 54