React-Native app throws SHA-1 error on build - android

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.

Issue should fixed by installing react-native-cli:
yarn global remove react-native
yarn global add react-native-cli
Credits source

Related

Expo eject throwing error - Something went wrong installing JavaScript dependencies, check your npm logfile or run npm install again manually

Till few hours ago expo eject was working completely fine. Suddenly it has started throwing error.
Things to consider:
I recently updated to Node v16 and npm v8.
Tried uninstall expo-cli, re-installing, downgrading, upgrading.
To install packages I have to run npm with flag --legacy-peer-deps. But, most likely it's because I have npm above v8 and few packages uses v6 or below (Found this online).
Versions:
Node - 16.16.0
npm - 8.14.0
expo - 5.4.12
Link to the error screenshot
P.S. - I am new to posting questions on Stackoverflow.
Looks like your dependencies are not getting located. Try running yarn install this might solve the problem.

React Native "RNCSafeAreaView" was not found in the UIManager

I am running a react-native application on Mac. but I am getting "RNCSafeAreaView" was not found in the UIManager.
update version of this module by typing following command in terminal:
npm install react-native-safe-area-context#1.0.2
it will solve this problem

React-Native The system cannot find the file specified

trying to run my first React-Native project but facing this error :
:ReactNative:Cannot run program "./node_modules/.bin/react-native" (in directory "C:\Users\abdul\AwesomeProject\android\.."): CreateProcess error=2, The system cannot find the file specified
:ReactNative:Automatic import of native modules failed.
Duplicate disclaimer : i read another question with the same title,
That question has a successful build result but in my case Build was not successful plus the accepted answer didn't work for me
OS:Windows 10.
yarn is used .
Android Studio:Exist with last SDK.
Setup: performed following docs
so what is the wrong i did?
Navigated into the project directory, try deleting node_modules and yarn.lock and re-running yarn install.
I managed to make it work by:
Uninstalled global react-native-cli
Created new project with npx react-native init MyApp
Started JS server with npx react-native start
Run in android emulator with npx react-native run-android
And it worked!

react-native run-android issue - error Android project not found

I create a react native app in C9. Now, I want to develop this app on my local machine with android settings. I downloaded the project.
cd myProjectFolder
react-native start
npm install
react-native run-android
Also, I add a project name in package.json.
The error is below:
error Android project not found. Are you sure this is a React Native project?
If android project/folder does not exit in your root project then run :
react-native eject
I encountered this issue after I ruan ./gradlew clean. Tried serval methods but vain. Then I ran ./gradlew in the Android directory. It worked for me.
// Android
./gradlew

React Native - Open Old Version Project (up to 0.48v)

I learning React-Native with Windows 10, Using Git Bash Command Prompt and Android Studio Emulator.
I have Install React Native globally by using npm install -g react-native-cli, I always create Project using react-native init ProjectName and
My Project Launching Method is
go into Project Directory with Git Bash CMD and execute react-native run-android.
I notice that most of the Project in Github are older version which consist of index.android.js and index.ios.js (My Project is newer version so it only have index.js). I been trying to open some older version Project, but it seem like it just does not launch with the method I mentioned above.
I also have tried react-native start method from How to open existing project in React Native? but I still not able to launch it.
The error message when I trying to launch the project is Command unrecognized. Make sure that you have run npm install and that you are inside a react-native project. This Problem only occur when I trying to launch project from Github, when I open my own Project there is no such problem.
ps. If I try use npm install in the project directory, it will have some error.
I have try to search from Net, most of their launching method are the same as above and does not work for me, so wanna ask that:
Is my method of launching React-Native is wrong in the very beginning?
Is there anything I need to install so that I can open old version React Native Project?
How can I open this project with my current situation? https://github.com/parkerdan/SampleNavigation
Thank you.
Extra Info (React Native CLI and Node Version):
$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
> process.version
'v8.9.4' (Node Version)
After whole day of Searching, I have found the Solution.
Whenever open any Project from Github or any sources, we have to ensure that the we have install all the required Dependencies, as Most of the Project using different type of dependencies that you may have not ever install.
Solution:
Download project
git clone https://github.com/parkerdan/SampleNavigation.git
2. Go to the Project Directory and Install dependencies (IMPORTANT)
Note: For unknown reason, npm install does not work
npm i
or yarn i
Run Project (or any launch method that work you)
react-native run-android
After you clone your project from git and cd to project folder, make sure you run npm install before you can react-native run-android.

Categories

Resources