top

How to Install React on Windows

React is an open-source, front-end library to develop web applications, it is JavaScript-based and led by the Facebook Team and by a community of individuals and corporations.In this document, we will cover installation procedure of react on windows 10 operating systemPrerequisitesThis guide assumes that you are using Windows 10. Before you begin, you should have a user account with installation privileges and should have unrestricted access to all mentioned web sites in this document.Audience:This document can be referred by anyone who wants to install latest nodejs on windows 10 System requirementsWindows 10 OS4 GB RAM10 GB free spaceInstallation ProcedureTo install react tooling we need nodejs and npm. First let’s understand what these are and why we need them.What is Nodejs and Why you need for react development?Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to develop wide variety of applications like network applications, command line tools, web api, web applications. You need nodejs for dev tooling (like local web server with live reloading features) and dev experience, you do not need nodejs to run react in production.What is npm and Why you need for react development?Npm stands for node package manager, it is a dependency management tool for javascript applications. This tool will help to install and the libraries and other tools to support react development.Let’s start with nodejs installation post completion on nodejs we will install create-react-app command line and will create a new react project1.Download nodejsVisit nodejs download page hereClick on windows Installer to download the latest version of node installer.2.Install nodejsClick on the downloaded node-vxx.xx.xx.msi (for example node-v10.15.0.msi) in previous step to start the installation which brings up below screen. Please click NextBy clicking next in previous step, you will be asked to accept license, please accept by clicking checkbox and click Next Click NextClick NextClick Install, this may need elevated permissions, provide necessary rights requested. This step would take several minutes to finish installationClick Finish3.Testing InstallationOpen command prompt and run below command to test nodenode -vYou should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your node version is > v10.0.0)Open command prompt and run below command to test npmnpm -vYou should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your npm version is  >5 )Install create react appSetting up productive react development environment would need to configure tools like babel, webpack which are complex to configure for a newbie in react world. There are several tools that help to alleviate this problem out of which create react app is the easiest and finest tool with production grade configurations pre-built. The goodness of this tool is, it does not lock in and allows you to alter the configuration by ejecting the create react app.  We will install create-react-app using npm. On terminal run the install command shown belownpm install -g create-react-appOn successful installation you should see the output like above (note your create-react-app version may be different by the time you run this install command)Test create-react-app To test the create-react-app, run below commandcreate-react-app --versionCongratulations, you have successfully installed create-react-appRunning the first Hello World applicationCreate react application using create-react-app command line using below commandcreate-react-app hello-reactThis command creates a new folder named hello-react and creates all the files and setups the necessary libraries within this folder and makes the react project ready to be executed without any additional configurationOnce project is created change into project directory and run application using npm start command as shown belownpm start command starts webpack development server which in turn performs all the build process and opens a browser window and loads application url which runs at http://localhost:3000 by default.You will see a beautiful window like below one which show you the react icon and some text.As discussed, create react app comes with great tooling, one of the productive features is webpack hot reloading, which deploys the change on live and saves developer lot of time to redeploy and reload work.Let’s open the project and make some changes to see the experience of this great feature. We will go through the project structure to understand the importance of the file create by create react app.Open the project which was created in previous step in any JS editor, here you see the project is open in vscode editor. On to the left in explorer section you see file explorer which shows you several folders and files which were created by create-react-app. Let’s walkthrough themnode_modules: This folder is managed by package manager (npm) and contains all the project library dependencies. Files in this folder should not be modified as the changes made are not guaranteed to be safe as updating/installing any other library can overwrite the changes made.public: This folder contains the assets that should be served publicly without any restrictions and contains files like index.html, favicon, manifest.jsonsrc: This is the folder that contains all your development effort. As a react developer you spent lot of time in this folder creating components and other sources of code.Now let’s get into the files inside this folder. To start with index.js is the starting file of this project where the execution on your code starts, this file injects App component which is exported from App.js. All the output you see in the browser is resultant on this file, lets make some change to this file, we will edit the existing code with new changes as shown in below screenshot.Save the file and switch back to browser to see the changes deployed and loaded as discussed, this one of the features of create-react-app to tooling setup.  With new changes your browser window should look like belowUninstall create-react-app You can uninstall any library or tool setup via npm install can be uninstalled using npm uninstall. Perform below step to remove create-react-app installed previouslyOn command prompt run npm uninstall -g @angular/cliUninstall nodejsTo uninstall previously installed nodejs follow below stepsPress windows + R to open run and type appwiz.cpl and press ok. This will open Programs and Features the look for node.jsDouble click node.js or right click and select uninstall which will prompt as below and then choose, YesNodejs uninstallation process will initiate and would ask you to authorize the same via user control. Choose Yes, this will take a while and complete
Rated 4.5/5 based on 30 customer reviews
Normal Mode Dark Mode

How to Install React on Windows

Susan May
Tutorials
11th Feb, 2019
How to Install React on Windows

React is an open-source, front-end library to develop web applications, it is JavaScript-based and led by the Facebook Team and by a community of individuals and corporations.

In this document, we will cover installation procedure of react on windows 10 operating system

Prerequisites

This guide assumes that you are using Windows 10. Before you begin, you should have a user account with installation privileges and should have unrestricted access to all mentioned web sites in this document.

Audience:

This document can be referred by anyone who wants to install latest nodejs on windows 10 

System requirements

  • Windows 10 OS
  • 4 GB RAM
  • 10 GB free space

Installation Procedure

To install react tooling we need nodejs and npm. First let’s understand what these are and why we need them.

What is Nodejs and Why you need for react development?

Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to develop wide variety of applications like network applications, command line tools, web api, web applications. You need nodejs for dev tooling (like local web server with live reloading features) and dev experience, you do not need nodejs to run react in production.

What is npm and Why you need for react development?

Npm stands for node package manager, it is a dependency management tool for javascript applications. This tool will help to install and the libraries and other tools to support react development.

Let’s start with nodejs installation post completion on nodejs we will install create-react-app command line and will create a new react project

1.Download nodejs

  • Visit nodejs download page here

  • Click on windows Installer to download the latest version of node installer.

2.Install nodejs

  • Click on the downloaded node-vxx.xx.xx.msi (for example node-v10.15.0.msi) in previous step to start the installation which brings up below screen. Please click Next

  • By clicking next in previous step, you will be asked to accept license, please accept by clicking checkbox and click Next 

  • Click Next

  • Click Next

  • Click Install, this may need elevated permissions, provide necessary rights requested. This step would take several minutes to finish installation

  • Click Finish

3.Testing Installation

  • Open command prompt and run below command to test node
node -v

You should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your node version is > v10.0.0)

  • Open command prompt and run below command to test npm
npm -v

You should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your npm version is  >5 )

Install create react app

Setting up productive react development environment would need to configure tools like babel, webpack which are complex to configure for a newbie in react world. There are several tools that help to alleviate this problem out of which create react app is the easiest and finest tool with production grade configurations pre-built. The goodness of this tool is, it does not lock in and allows you to alter the configuration by ejecting the create react app.  

We will install create-react-app using npm. On terminal run the install command shown below

npm install -g create-react-app

On successful installation you should see the output like above (note your create-react-app version may be different by the time you run this install command)

Test create-react-app 

To test the create-react-app, run below command

create-react-app --version

Congratulations, you have successfully installed create-react-app

Running the first Hello World application

  • Create react application using create-react-app command line using below command
create-react-app hello-react

This command creates a new folder named hello-react and creates all the files and setups the necessary libraries within this folder and makes the react project ready to be executed without any additional configuration

  • Once project is created change into project directory and run application using npm start command as shown below

npm start command starts webpack development server which in turn performs all the build process and opens a browser window and loads application url which runs at http://localhost:3000 by default.

You will see a beautiful window like below one which show you the react icon and some text.

As discussed, create react app comes with great tooling, one of the productive features is webpack hot reloading, which deploys the change on live and saves developer lot of time to redeploy and reload work.

Let’s open the project and make some changes to see the experience of this great feature. We will go through the project structure to understand the importance of the file create by create react app.

Open the project which was created in previous step in any JS editor, here you see the project is open in vscode editor. On to the left in explorer section you see file explorer which shows you several folders and files which were created by create-react-app. Let’s walkthrough them

node_modules: This folder is managed by package manager (npm) and contains all the project library dependencies. Files in this folder should not be modified as the changes made are not guaranteed to be safe as updating/installing any other library can overwrite the changes made.

public: This folder contains the assets that should be served publicly without any restrictions and contains files like index.html, favicon, manifest.json

src: This is the folder that contains all your development effort. As a react developer you spent lot of time in this folder creating components and other sources of code.

Now let’s get into the files inside this folder. To start with index.js is the starting file of this project where the execution on your code starts, this file injects App component which is exported from App.js. All the output you see in the browser is resultant on this file, lets make some change to this file, we will edit the existing code with new changes as shown in below screenshot.

Save the file and switch back to browser to see the changes deployed and loaded as discussed, this one of the features of create-react-app to tooling setup.  

With new changes your browser window should look like below

Uninstall create-react-app

 You can uninstall any library or tool setup via npm install can be uninstalled using npm uninstall. Perform below step to remove create-react-app installed previously

  • On command prompt run npm uninstall -g @angular/cli

Uninstall nodejs

To uninstall previously installed nodejs follow below steps

  • Press windows + R to open run and type appwiz.cpl and press ok. 

  • This will open Programs and Features the look for node.js

  • Double click node.js or right click and select uninstall which will prompt as below and then choose, Yes

  • Nodejs uninstallation process will initiate and would ask you to authorize the same via user control. Choose Yes, this will take a while and complete

Susan

Susan May

Writer, Developer, Explorer

Susan is a gamer, internet scholar and an entrepreneur, specialising in Big Data, Hadoop, Web Development and many other technologies. She is the author of several articles published on Zeolearn and KnowledgeHut blogs. She has gained a lot of experience by working as a freelancer and is now working as a trainer. As a developer, she has spoken at various international tech conferences around the globe about Big Data.


Website : https://www.zeolearn.com

Leave a Reply

Your email address will not be published. Required fields are marked *

REQUEST A FREE DEMO CLASS

SUBSCRIBE OUR BLOG

Follow Us On

Share on

Useful Links

20% Discount