DEV Community

Dattatray Bodake
Dattatray Bodake

Posted on

How to Create a React + Vite Application Using Command Prompt

Follow these steps to set up a React project using Vite via Command Prompt:

Step 1: Set Up the Project Directory

  • Create a new folder where you want to build your React project.

  • Open the newly created folder and copy the folder path.

  • Open Command Prompt.

  • Navigate to the folder using the cd command:
    cd

  • Example:
    cd C:\Users\YourName\Documents\ReactProjects\MyApp

Step 2: Create the React + Vite Project

  • Run the following command to create a new Vite project:
    npm create vite@latest

  • When prompted with ✔ Ok to proceed? (y), press y and hit Enter.

  • Enter your project name (instead of the default vite-project) and press Enter.

  • From the framework list, select React, then press Enter.

  • From the variant list, choose JavaScript, and press Enter.

  • The React + Vite project will be created successfully.

Step 3: Install Project Dependencies

  • Navigate into the newly created project directory: cd

Example:
cd my-react-app

  • Run the following command to install npm (if necessary):
    npm install -g npm@11.2.0

  • Install the project dependencies:
    npm install

Step 4: Run the React Project

  • Start the development server:
    npm run dev

  • After the server starts, copy the local development URL displayed in the terminal (e.g., http://localhost:5173) and paste it into your browser.

Step 5: View and Customize Your Application

  • You should now see the default Vite + React landing page with the logo and a simple counter example.

  • Customize and design the application according to your needs.

Top comments (0)