Here are the steps to use Vite to start a React Project:
1. Navigate to the directory where you want to create the project:
Use the cd command in Terminal to navigate to the directory where you want to create the project. For example:
cd path/to/your/directory
2. Create a React project:
In the same directory, run the following command to create a new Vite project with the React template:
npm create vite@latest my-react-app -- --template react
This will create a folder named my-react-app in the current directory and initialize the project inside it.
3. Enter the project directory:
Use the cd command to enter the newly created project directory:
cd my-react-app
4. Install dependencies:
Run the following command in the project directory to install the project dependencies:
npm install
If some errors will occur in this problem, please go to Errors occurred while using Vite
5. Start the development server:
Finally, run the following command to start the Vite development server:
sudo npm run dev
The console shows that the application has started on localhost port 5173, i.e. the address http://localhost:5173/:
By following these steps, you have successfully created and started a new React project in the directory of your choice.
Top comments (0)