Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic React App

A simple React application that displays "Hello world".


Prerequisites

Before you begin, you need to install Node.js on your computer. Node.js includes npm (Node Package Manager), which is used to install project dependencies.

Step 1: Install Node.js

macOS

Option A: Download from website

  1. Go to https://nodejs.org
  2. Download the LTS (Long Term Support) version
  3. Open the downloaded .pkg file and follow the installation wizard

Option B: Using Homebrew (if you have Homebrew installed)

brew install node

Windows

  1. Go to https://nodejs.org
  2. Download the LTS version for Windows
  3. Run the .msi installer
  4. Follow the installation wizard (keep all default options)
  5. Restart your computer after installation

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install nodejs npm

Step 2: Verify Installation

Open a terminal (or Command Prompt on Windows) and run:

node --version
npm --version

You should see version numbers printed (e.g., v20.10.0 and 10.2.3). If you see these, Node.js and npm are installed correctly.


Getting Started

Step 3: Navigate to the Project Folder

Open a terminal and navigate to the project directory:

cd path/to/basic-react-app

Replace path/to/basic-react-app with the actual path where this project is located on your computer.

Step 4: Install Dependencies

Run the following command to install all required packages:

npm install

This will read the package.json file and download all necessary dependencies into a node_modules folder.

Step 5: Start the Development Server

Run:

npm run dev

You should see output similar to:

VITE v5.x.x  ready in XXX ms

➜  Local:   http://localhost:3001/
➜  Network: use --host to expose

Step 6: View the App

Open your web browser and go to:

http://localhost:3001

You should see "Hello world" displayed on the page!


Available Commands

Command Description
npm run dev Start the development server
npm run build Build the app for production
npm run preview Preview the production build locally

Stopping the Server

To stop the development server, go back to your terminal and press Ctrl + C.


Troubleshooting

"command not found: node" or "command not found: npm"

  • Node.js is not installed or not in your PATH
  • Try restarting your terminal or computer after installation
  • Reinstall Node.js from https://nodejs.org

Port already in use

  • Vite will automatically try another port (e.g., 5174, 5175)
  • Check the terminal output for the correct URL

Permission errors on npm install

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages