How to Install ReactJS and NodeJS on a MacBook

Installing ReactJS and NodeJS on your Mac machine is a straightforward process. This guide will walk you through each step, from setting up NodeJS to creating your first ReactJS application. Let’s get started!

Step 1: Install Homebrew

Homebrew is a popular package manager for macOS that simplifies the installation of software. First, check if you already have Homebrew installed by running:

bash
brew -v

If Homebrew is not installed, you can install it by running the following command in your terminal:

bash

/bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)

Follow the on-screen instructions to complete the installation. Once installed, you can verify it by running:

bash
brew -v

Step 2: Install NodeJS and npm

NodeJS and npm (Node Package Manager) are essential for running ReactJS. Using Homebrew, you can install NodeJS, which includes npm:

bash
brew install node

After the installation is complete, verify that NodeJS and npm are installed correctly:

bash
node -v
npm -v

This should display the versions of NodeJS and npm installed on your machine.

Step 3: Install Create-React-App

Create-React-App is a tool that helps you set up a new ReactJS project with a sensible default configuration. You can install it globally using npm:

bash

npm install -g create-react-app

Verify the installation by checking the version:

bash
create-react-app --version

Step 4: Create a New ReactJS Project

Now that you have Create-React-App installed, you can create a new ReactJS project. Navigate to the directory where you want to create your project and run:

bash
npx create-react-app my-react-app

Replace my-react-app with the name of your project. This command will set up a new ReactJS project with all the necessary files and dependencies.

Step 5: Start the ReactJS Application

Navigate to the project directory and start the development server:

bash
cd my-react-app
npm start

This command will start the ReactJS development server and open the application in your default web browser. By default, the app will be available at http://localhost:3000.

Step 6: Open the Project in a Code Editor

You can use any code editor to work on your ReactJS project. Visual Studio Code is a popular choice. If you don’t have it installed, you can download it from the official website.

Once installed, you can open your project by navigating to the project directory in the terminal and running:

bash
code .

This command will open the current directory in Visual Studio Code.

Conclusion

You have successfully installed NodeJS and ReactJS on your Mac machine and created your first ReactJS application. You can now start developing your application, adding components, and building your project. Happy coding!

If you encounter any issues during the installation or setup process, feel free to refer to the official documentation for NodeJS and ReactJS.

Scroll to Top