How to run a cloned React application with Vite on Pop!_OS 22.04

Vite
Vite is a build tool for modern web development that aims to provide a faster and more efficient development experience. It's specifically designed for building web applications using modern JavaScript frameworks such as React, Vue, and others. The name "Vite" is derived from the French word for "fast."
Let's get down to business
Shall we?

Check your OS (optional)
This step is just to make sure you have Pop!_OS installed.
COPY
uname -a
hostnamectl
lsb_release -a
cat /etc/os-release
Output

Update packages info
sudo apt-get update
Running sudo apt-get update is an important step before installing or upgrading packages on your system because it ensures that you have the most up-to-date information about available packages.
Without updating the package index, you might not see the latest versions of software or be able to install new packages that have been added to the repositories since the last update.
Install Vite Locally
Make sure that Vite is listed as a dependency in your project's package.json file.

If it's not there, you should add it as a development dependency:
npm install --save-dev vite
Check npm Scripts
Execute this step if you are cloning a React application.
Ensure that your package.json file contains the correct npm scripts. In your case, the "dev" script seems to be using "vite". Confirm that the "dev" script is defined as follows:
"scripts": {
"dev": "vite"
}

Verify npm Installation
which npm
npm --help

Make sure that npm is installed.
Install dependencies
Make sure that npm is installed and your project has the required dependencies.
npm install
Output

Check npm Binaries
Sometimes, the binaries installed by npm may not be in your system's PATH. Ensure that the node_modules/.bin directory is in your PATH or try running the command with npx:
npx vite
Successful output:

Start the server
The command npm run dev is typically used to start a development server for a web application. It's part of the npm scripts defined in the "scripts" section of a project's package.json file.
npm run dev
Successful output:

Done
Celebrate

Reach me out
Final thoughts
Thank you for reading this article.
If you have any questions, thoughts, suggestions, or corrections, please share them with us.
We appreciate your feedback and look forward to hearing from you.
Feel free to suggest topics for future blog articles. Until next time!




