Install NPM and Node.js
On a Home Computer
This installation only needs to be done once.
If you don't install Node.js, which also installs NPM, you'll get an error when you try to run
npm create vite@latest. It will say something like
npm : The term 'npm' is not recognized.
Go to https://nodejs.org/en/download/ and download the latest version of Node.js. When you install Node.js, it will also install NPM.
If you still have issues after installation, follow these instructions for Windows.
Create a project using Vite
Create a project from scratch using Vite.
- Open Visual Studio Code or the Command Prompt and go to your main folder, then one with your name.
- Open a new terminal by clicking on the
Terminalmenu button, choosing
New Terminal, and then enter the following command:
npm create vite@latest
- Enter the name of your project when prompted. Don't use spaces. Example:
TypeScriptif you want.
- Open this new project by going to
Open Folder...and selecting the folder that was just created.
- Open the terminal by clicking on
Terminalin the menu and selecting
New Terminal. In the terminal type
npm install, which will install the dependencies for your project.
- In your project folder, delete
main.js. You can also delete the content inside
style.cssif you want.
- Click on
package.json, then click on the
Debuglink that's shown between lines 5 and 6. Choose
devsince we are in the development process.
- In the terminal at the bottom, look for the
Local: http://127.0.0.1:xxxx. Hold down the control button and click on that link. This will open a preview of your app.