‘Yarn’ is not recognized as an internal or external command React Native error Solved
If you are encountering the error ” ‘Yarn’ is not recognized as an internal or external command” while working with React Native, don’t worry! This is a common issue and can be easily resolved with a simple fix. In this article, we will go through the steps to solve this error.
Step 1: Install Yarn
The first step to solve this error is to ensure that Yarn is properly installed on your system. Yarn is a package manager that is commonly used for managing dependencies in React Native projects. You can download and install Yarn from the official website or through a package manager such as Homebrew.
Step 2: Add Yarn to your PATH
After installing Yarn, you need to add it to your system’s PATH environment variable. This will allow your system to recognize the ‘yarn’ command in the terminal. To do this, you can follow these steps:
- Open the Control Panel and go to System and Security > System > Advanced system settings.
- Click on the “Environment Variables” button.
- Under “System variables”, find the “Path” variable and click on “Edit”.
- Add the path to the Yarn bin directory (e.g. C:Program Files (x86)Yarnbin) to the list of paths.
- Click “OK” to save the changes.
Step 3: Restart the Terminal
After adding Yarn to your PATH, you will need to restart your terminal or command prompt in order for the changes to take effect. Once you have restarted the terminal, you should be able to use the ‘yarn’ command without encountering the error.
Example
Here is an example of how you can use the ‘yarn’ command in a React Native project:
// Install dependencies
yarn install
// Start the project
yarn start
With these simple steps, you should be able to solve the “‘Yarn’ is not recognized as an internal or external command” error in your React Native project. Happy coding!