Categories: softare development

How to Revive Your Old React Native Project

React Native is a great library for building awesome applications.

But sometimes after downloading a project from Github or moving that project around from directory to directory, you’ll find that it throws off some reprehensible error.

This also seems to be common problem with projects that make use of Node Package Managers. So here are some of the steps you can take to troubleshoot this problem.

1. Delete the “node_modules” Folder

This is one of the crucial steps you should take especially when you have just downloaded a new React or React Native project.

The “node_modules” folder contains information about the library configurations that you have used for your project.

Some of these libraries are installed based on system configuration which apparently differs from system to system. So what you want to do is to delete that folder and re-install it

2. Run “yarn install” or “npm install”

Depending on whether you are using yarn or npm for your project (although yarn seems to be more favoured and recommended), after deleting your the “node_modules” folder, you should go to terminal and at the root of your project run the following command:

yarn install
//or 
npm install
//Don't run both

Running any of the above command will immediately re-install the node_modules folder along with other specified dependencies in the package.json file.

3. Clear and Re-install Pods

The iOS version of your React Native project or app relies heavily on Cocoa-pods to manage all dependences used by your project.

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. You can read more about getting started with Cocopods here.

Meanwhile, for an already-existing project you can run the following command on your terminal:

cd ios
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod install

4. DebugManifest Failed Error

Sometimes when compiling your React Native project for Android, you’ll get the DebugManifest Failed Error.

This usually occurs because Jdk is not properly configured. What you can try is to check your jdk version and try to export it to your Java_home directory.

First, check for your jdk version:

/usr/libexec/java_home -V

Next, export to java_home directory:

export JAVA_HOME=`/usr/libexec/java_home -v 15.0.2`  //replace with your correct version

Conclusion

React Native is a great library, but it’s also far from perfect (Do we really have perfect anything?)

More efforts and upgrades are being put in place to ensure it best serves its purpose, which is build native apps fast and easy.

How to make a POST Request in React Native

Share
Published by
codeflare

Recent Posts

The Golden Ratio (φ)

1. What Is the Golden Ratio? The Golden Ratio, represented by the Greek letter φ (phi), is…

1 day ago

CSS Combinators

In CSS, combinators define relationships between selectors. Instead of selecting elements individually, combinators allow you to target elements based…

4 days ago

Boolean Algebra

Below is a comprehensive, beginner-friendly, yet deeply detailed guide to Boolean Algebra, complete with definitions, laws,…

5 days ago

Why It’s Difficult to Debug Other People’s Code (And what Can be Done About it)

Debugging your own code is hard enough — debugging someone else’s code is a whole…

6 days ago

Complete Git Commands

Git is a free, open-source distributed version control system created by Linus Torvalds.It helps developers: Learn how to…

1 week ago

Bubble Sort Algorithm

Bubble Sort is one of the simplest sorting algorithms in computer science. Although it’s not…

1 week ago