To fix the issue of metro (the local dev server) running from the wrong folder, you need to check if metro is currently running, stop it if it is, and then restart it in the current project directory. Here’s how you can do it:
-
Open the terminal or command prompt and navigate to the directory where the current project is located. For example, if your project is in a folder named “my-project”, you can use the following command to navigate to that folder:
cd path/to/my-project
-
Once you are in the correct project directory, you can check if metro is running by running the following command:
npx react-native start
- If metro is running, you will see the output in the terminal. In that case, you need to stop metro before restarting it in the current project. To stop metro, you can use the keyboard shortcut “CTRL + C” (or “CMD + C” on macOS) in the terminal where metro is running.
-
After stopping metro, you can restart it in the current project directory using the following command:
npx react-native start