create account

Helping A Friend Out With An Error While Cloning And Running A React App Locally by rufans

View this thread on: hive.blogpeakd.comecency.com
· @rufans · (edited)
$13.02
Helping A Friend Out With An Error While Cloning And Running A React App Locally
The image below is the final interface after every issue was solved.
![Screenshot (13).png](https://images.hive.blog/DQmf4ygd6TpUFXgicmaKjpnXLFQAJjb4pSG2Xg1VhEehfNC/Screenshot%20(13).png)
 
It was a late night at my end when I got the below message from a friend via discord
> Did you figure out about cloning from Github? I am also having a problem now.
Did you follow any tutorials?
I already did npm install react-scripts --save   and whatever the online suggested but I still can't use npm start
it's showing me 'react-scripts' is not recognized as an internal or external command, do you know how to solve it?

My reply was to clone the repo at my end in the morning.  Since I have worked with cloning a Github repo before now,  I never thought I would encounter any issue. 
Morning came and I faced it! Errors upon Errors. But I was able to figure it out at my end. Below are the steps taken

### Setting Up An Environment Before Cloning
 * I created a folder with ```mkdir youtube-clone```
* I cloned the repo she provided with ```git clone https://github.com/safak/youtube.git```

After successfully cloning it,  I noticed the project files are the same as what she showed me last night.  
![Screenshot (12).png](https://images.hive.blog/DQmZxjz5XN41bVDiz9trmPFHr416vNpxyoHt8C8FtVLFgZX/Screenshot%20(12).png)

 At this point, I knew those files aren't valid React app files. And since the files look exactly like a JavaScript project, I decided to open it with a Live Server. It compiled and ran as expected. 
 
![Screenshot (11).png](https://images.hive.blog/DQmQeqhK2j7aLbywAcFo7yV95TBCt6BbL63D2CrnnduR3bp/Screenshot%20(11).png)

But I knew she was working on a React project and not JavaScript. So,  I decided to examine the repo properly on GitHub. Then, I noticed that the repo has 28 branches. These branches represent a different YouTube tutorial by the repo owner.

Before she messaged me, she had told me she was working on a portfolio project via a  React Portfolio tutorial on youtube. So, I decided to search for it among the 28 branches. And Yes.! I found two results. **React-portfolio** and **React-portfolio-website**.

 I went back to my gitbash to navigate to one of those branches.
While I was still on the clone directory, I navigated to  **React-portfolio-website** with this command ```git checkout react-portfolio-website``` then, Vscode displayed the react files as you can see from the image below.

![Screenshot (14).png](https://images.hive.blog/DQmZqgnAfjAcZG58siHvsv7W2HVsHKe8gxiDkND375Kb7yp/Screenshot%20(14).png)


Starting the project with **npm start** returned this error  ```'react-scripts' is not recognized as an internal or external command,
operable program or batch file.```  This was the exact error she talked of last night.

However, instead of trying to install **react-scripts**, I decided to run **npm install**  and this took about 2mins to complete.

Now, starting the project with **npm start** open the project on my *localhost:3000* with this error 

```./src/components/intro/Intro.jsx  Module not found: Can't resolve '../../img/me.png' in 'C:\Users\HP\desktop\youtube\src\components\intro```


From the error above, I could tell the compiler failed to find **me.png**.  Instead of searching around for the me.png file on the repo, I duplicated the **start.png** file. One of the available images I  found on the **Img path**.  I renamed the duplicate from **star.png** to **me.png**.  

Saving the project with **Ctrl S** refreshed my localhost:3000 into a webpack error page. I got shocked if this was going to be another problem? 😂.  Instead of panicking or Googling a webpack error page, I manually refreshed the page on my browser with **Ctrl R** and ***Vwa-Lah, Wa-Lah, Wa-La!!!*** It worked.

 
![Screenshot (13).png](https://images.hive.blog/DQmf4ygd6TpUFXgicmaKjpnXLFQAJjb4pSG2Xg1VhEehfNC/Screenshot%20(13).png)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 113 others
properties (23)
authorrufans
permlinkhelping-a-friend-out-with-an-error-while-cloning-and-running-a-react-app-locally
categoryhive-169321
json_metadata{"tags":["react","javascript","code","development","neoxian"],"image":["https://images.hive.blog/DQmf4ygd6TpUFXgicmaKjpnXLFQAJjb4pSG2Xg1VhEehfNC/Screenshot%20(13).png","https://images.hive.blog/DQmZxjz5XN41bVDiz9trmPFHr416vNpxyoHt8C8FtVLFgZX/Screenshot%20(12).png","https://images.hive.blog/DQmQeqhK2j7aLbywAcFo7yV95TBCt6BbL63D2CrnnduR3bp/Screenshot%20(11).png","https://images.hive.blog/DQmZqgnAfjAcZG58siHvsv7W2HVsHKe8gxiDkND375Kb7yp/Screenshot%20(14).png"],"app":"hiveblog/0.1","format":"markdown"}
created2021-10-18 13:49:00
last_update2021-10-19 23:52:06
depth0
children0
last_payout2021-10-25 13:49:00
cashout_time1969-12-31 23:59:59
total_payout_value6.545 HBD
curator_payout_value6.474 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,881
author_reputation101,081,674,466,198
root_title"Helping A Friend Out With An Error While Cloning And Running A React App Locally"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id107,124,687
net_rshares12,092,225,213,809
author_curate_reward""
vote details (177)