Cet article n’est pas encore traduit, il est donc affiché en anglais.
React + Vite Setup for Beginners: Install Node.js and Run Your First React App
A beginner guide to Node.js, npm and Vite: check your versions, create a React project with npm create vite@latest and run it on localhost:5173.
This is the written version of my first React lesson. You will learn what Node.js and npm are, how to check that they are installed, and how to create and run a React project with Vite.
▶ WATCH ON YOUTUBEWatch the video
▶ WATCH ON YOUTUBEFull video
Where JavaScript normally runs
JavaScript normally runs inside the browser: Safari, Firefox, Edge, Chrome. Open Inspect Element, go to the Console tab and type:
console.log("Hello World JavaScript")The browser runs it at once. From the same console you can change the page text, the background colour and the text colour. That is how JavaScript controls a website: page content, design, buttons, form validation and animation.
What Node.js changes
Node.js lets JavaScript run outside the browser, directly on your computer from the terminal. So JavaScript is not only for the front end any more. You can use it for:
- APIs and servers
- command-line tools and automation
- modern front-end tools such as React and Vite
What npm is
npm means Node Package Manager. It is normally installed together with Node.js. When you want a library such as React, Express or Tailwind CSS, you install it with npm.
Install Node.js
- Go to https://nodejs.org.
- You will see two versions: LTS and Current.
- Choose LTS (long-term support). It is more stable and better for learning and real projects.
- Download the installer for Mac or Windows, open it and follow the steps.
Check that it works
Open a terminal. On Mac use Terminal. On Windows use PowerShell, Command Prompt or the terminal inside VS Code.
node -v
npm -vIf each command prints a version number, both are installed correctly.
Create the project with Vite
Pick a place for your code. I use a folder on the desktop:
cd Desktop
mkdir coding
cd codingmkdir makes a new folder. cd changes into it.
Now create the project:
npm create vite@latestnpm downloads and runs the newest Vite project creator. It asks three things:
| Question | Answer in this lesson |
|---|---|
| Project name | node-js-vite-demo |
| Framework | React |
| Variant | JavaScript |
Run it
Go into the new folder, install the packages and start the dev server:
cd node-js-vite-demo
npm install
npm run devnpm run dev starts the Vite development server and prints a local address, usually http://localhost:5173. Open it in your browser. Your React project is running, which also proves that Node.js, npm and Vite all work.
To open the project in VS Code from the same folder:
code .If that command is not found, open VS Code and choose the folder by hand. Now change some code, save, and the browser updates very fast.
Links
- Full video: https://youtu.be/KJQRxZRrU0M
- Node.js: https://nodejs.org
- Vite: https://vitejs.dev
- React: https://react.dev
- Next lesson: a clean React folder structure
What are you building first with React?


