Course Content
REACT Tutorial
About Lesson

Node.js and npm/yarn installation

Setting up your development environment for React begins with the installation of Node.js and npm or yarn. In this guide, we’ll walk you through the process, ensuring a seamless setup for your React projects.


Before diving into React development, make sure you have the following prerequisites installed on your machine:

1. Node.js and npm

React relies on Node.js and npm for package management. Install the latest stable versions of Node.js and npm by visiting the official Node.js website.

2. Code Editor

Choose a code editor that aligns with your preferences. Popular choices include Visual Studio Code, Atom, or Sublime Text. Install your preferred editor before proceeding.

Installing Node.js and npm/yarn

Now that your machine is ready, let’s install Node.js along with npm or yarn.

1. Install Node.js and npm

Download and install Node.js from the official website. npm is included with Node.js, so once installed, you have npm ready to use.

2. Alternatively, Install Node.js and yarn

If you prefer yarn over npm, you can install it by first installing Node.js and then running the following command:

npm install -g yarn

Verifying Installations

After the installations, ensure everything is set up correctly by checking the versions of Node.js, npm, and yarn.

Check Node.js and npm versions
node -v
npm -v
Check yarn version
yarn -v

Create a React App

With Node.js, npm (or yarn) installed, you can now create a new React app using Create React App.

1. Open your terminal and run:
npx create-react-app my-react-app
2. Navigate to your project directory:
cd my-react-app

Running the Development Server

To view your React app in action, start the development server:

npm start