How to install React on Windows, macOS, and Linux
You don't install React itself on your computer: you install Node.js, then create a project that includes React as a dependency.
React has become an essential tool for modern web development, and getting it set up on your machine is the first step to building great user interfaces.
React is a popular JavaScript library for building user interfaces. Its component-based approach makes it easier to create fast, interactive, and maintainable interfaces, which is why so many developers and companies use it.
In this guide, you'll set up React on Windows, macOS, and Linux. You don't install React itself on your computer: you install Node.js, then create a project that includes React as a dependency. So we'll install Node.js on each operating system, then create and run a React app with Vite. All the steps were tested with Node.js 24, React 19, and Vite 8.
What is React?#
React is a JavaScript library for building user interfaces. It was created by Jordan Walke, a software engineer at Facebook, and released as open source in 2013. Today, Meta and a large community maintain it.
React apps are built from components: reusable pieces of UI, such as a button, a form, or a whole page, that manage their own state and describe what to render. You combine small components into larger ones to build complete interfaces, which reduces duplicate code and makes apps easier to maintain.
When a component's data changes, React works out what changed and updates only those parts of the page, so you describe what the UI should look like, and React takes care of updating the browser's DOM efficiently.
Who uses React?#
React is used by a wide range of developers:
- Frontend developers use it to build interactive user interfaces that work with backend services and APIs.
- Full-stack developers use it with backend technologies like Node.js, Express, and databases to build complete web applications, often with a framework like Next.js.
- Mobile developers use React Native, which brings React's approach to iOS and Android apps.
Many well-known companies use React too, including Meta for Facebook and Instagram on the web, Netflix, Airbnb, Uber, Reddit, and Dropbox.
Advantages of using React#
React offers several advantages that make it a popular choice for modern web development:
- Reusable components: You build your UI from components that you can reuse across your app, which keeps your code consistent and easier to maintain.
- Efficient updates: React updates only the parts of the page that change, and you don't need to manipulate the DOM yourself.
- A huge ecosystem: Thousands of libraries and tools work with React, from routing and state management to UI component libraries, and frameworks like Next.js and React Router add routing, data loading, and server rendering.
- Strong community and job market: React has an extensive community that shares tutorials, answers, and open source code, and React skills are in high demand.
React prerequisites#
Before you install React, make sure you have:
- Basic knowledge of HTML, CSS, and JavaScript: React components are written in JavaScript, with JSX, a syntax that looks like HTML, and you style them with CSS.
- Familiarity with the command line: You'll create and run your project from a terminal.
- A code editor, such as Visual Studio Code.
- A modern web browser, such as Chrome, Firefox, Edge, or Safari, to view your app.
React doesn't have special hardware requirements: any computer that can run a modern browser and Node.js can run a React development environment.
How to install Node.js#
React projects use Node.js and npm, the Node.js package manager, to install dependencies and run development tools. Vite, the build tool we'll use, requires Node.js 20.19 or later, or 22.12 or later, so install the current long-term support (LTS) version.
Follow the steps for your operating system below. For more options, see our guide on how to install Node.js.
Windows#
- Go to the Node.js download page and download the Windows installer (
.msi) for the LTS version. - Run the installer and follow the prompts. Keep the default options, which install npm and add Node.js to your
PATH.
You can also install Node.js with WinGet, the package manager built into Windows, by running winget install OpenJS.NodeJS.LTS in a terminal.
macOS#
- Go to the Node.js download page and download the macOS installer (
.pkg) for the LTS version. - Open the downloaded file and follow the prompts: accept the license agreement, keep the default location, and enter your password when asked.
If you use Homebrew, you can install Node.js with this command instead:
brew install nodeLinux#
Most Linux distributions include Node.js in their package repositories, but the version is often too old. For example, Ubuntu 24.04's nodejs package is Node.js 18, which can't run current versions of Vite. Instead, install the current LTS version from NodeSource, which provides up-to-date packages for Debian and Ubuntu:
sudo apt update
sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt install -y nodejsThe NodeSource nodejs package includes npm. For other distributions, or to switch between Node.js versions easily, you can use a version manager such as nvm or fnm.
Verify the installation#
On any operating system, open a new terminal window and check the versions of Node.js and npm:
node -v
npm -vYou should see version numbers, such as v24.22.3 and 11.19.1. If you get a "command not found" error on Windows or macOS, close and reopen your terminal so it picks up the new PATH.
How to create a React app#
With Node.js installed, the steps to create a React app are the same on Windows, macOS, and Linux.
You may have seen tutorials that use Create React App (create-react-app). It was officially deprecated in February 2025 and is no longer maintained, so don't use it for new projects. The React team now recommends starting with a framework like Next.js, or building your app with a tool like Vite.
Step 1: create the project with Vite#
Vite is a fast build tool with a development server and a production build command, and it has an official React template. Open a terminal, go to the folder where you want to create your project, and run:
npm create vite@latest my-app -- --template reactReplace my-app with the name you want for your project. This creates a my-app folder with a React project. To use TypeScript instead of JavaScript, use --template react-ts.
Depending on the version, Vite may ask whether to install the dependencies and start the app right away. If you accept, skip to Step 3.
Step 2: install the dependencies#
Go into the project folder and install the dependencies, including React:
cd my-app
npm installThis downloads React, React DOM, Vite, and the other packages the project needs into the node_modules folder.
Step 3: start the development server#
Start the development server:
npm run devVite starts in under a second and shows the address of your app:
VITE v8.4.0 ready in 726 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to exposeOpen http://localhost:5173/ in your browser. You'll see the Vite and React starter page, with a counter button that you can click.
Now open src/App.jsx in your code editor, change some text, and save the file. The page updates instantly, without a reload. That's Hot Module Replacement, and it's how you'll see your changes while you build your app.
If you're working on a remote Linux server, run npm run dev -- --host instead, so the development server listens on the server's network address, and open http://<server-ip>:5173/ in your browser.
To stop the development server, press Ctrl + C in the terminal.
Step 4: build your app for production#
When you're ready to deploy your app, create a production build:
npm run buildVite bundles and optimizes your app into the dist folder, which contains plain HTML, CSS, and JavaScript files that you can host on any static hosting service. To check the build locally, run npm run preview.
Congratulations! You've installed React and created your first React app.
Alternative: start with a framework#
For a full application, with routing, data loading, and server rendering, the React team recommends starting with a framework. For example, to create a Next.js app, run:
npx create-next-app@latest my-appThe command asks a few questions, such as whether to use TypeScript and Tailwind CSS, and then creates the project. Run npm run dev in the project folder and open http://localhost:3000/.
Other options include React Router, in its framework mode, and Expo, for apps that run on the web and on mobile devices.
Summary#
In this guide, you installed Node.js on Windows, macOS, and Linux, created a React app with Vite, ran it with the development server, and built it for production. You also learned why Create React App is no longer the way to start a React project, and how to start with a framework like Next.js instead.
Now that React is installed, it's time to start building. Learn the fundamentals in our guides to JSX, conditional rendering, and React Hooks like useState and useEffect.
When your app is ready, you can deploy it for free with Sevalla's Static Site Hosting, or use Application Hosting for apps that need a server, such as Next.js apps with server rendering.