After watching react tutorials from Udemy and Youtube , you have decided to create a boilerplate react app and you are getting into some trouble while using npm package called create-react-app. This tutorial will make sure you solve those issues.
Step 1:
Forget all the steps you had done before and start fresh with below steps.
Open Your terminal and type
mkdir react-app
Then lets get into that folder
cd react-app
Step 2:
If you have already done something like
npm install create-react-app react-app
And got some errors, Forget about those errors and do as follows.
In the command line paste these codes one by one
npm rm -g create-react-app react-app
npm install -g create-react-app
npx create-react-app react-app
If you did not do the above steps earlier simply paste the below code in terminal and you are good to go.
npm install -g create-react-app
The above code need to be used only once globally in your system after that there is no need to install that. We must only use below code after that.
npx create-react-app react-app
And thats it, you have created a new react app. Congratulations!
My Personal Experience:
When I first started to learn react and decided to create a react app with create-react-app, I was stuck with creating the react app for almost a day.
After a lot of stackoverflow searching I found these steps to work absolutely fine.
If you are a beginner (and have very slow internet connection),
From my experience you have to wait atleast 10-30 minutes for each command to execute. I was very impatient at first, then after trying two to three times I finally found how to do it.
You can pin this post and use it whenever you want to create a new react app.
Thanks For reading!
This is my first blog in dev.to So please give me your feedback in the comments. If you like it please heart it.
Top comments (4)
Basically create a folder, Import the folder through VSCode, open up the terminal then write, npx create-react-app my-app
after installation then you will be in your directory not in the main folder, So you have to type cd my-app snd npm start. done. This is actually my way of doing.
Yeah bro. At start of my react journey, it was very painful to create a react app as I had very slow internet connection. After a lot of research I found these steps to work absolutely fine. Glad you shared your way of doing this.
Aye bro, I know that feelings bro. keep up the good work, be positive and never give up.
Thank you mate.