Firstly, make sure that the latest version of NodeJS is installed on your computer. If it’s not installed you can install it from here or if you’re on Linux you can use the following terminal command to install NodeJS :
sudo apt install nodejs
After, NodeJS has been installed properly cd into the directory of your choice and type the following terminal command to set up Svelte project template using Vite :
npm init vite@latest
In the next step give the project a name (or just leave the default name ‘vite-project’ if you want) and hit Enter.
Next select Svelte and then select JavaScript (or TypeScript depending upon the language of your choice) and hit Enter again.
In the next step cd into the project folder you’ve just created and type this :
npm install
The above terminal command will install all the dependencies required to run and implement your project.
Next type the below command :
npm run dev
This command gives you a link to the template project you’ve just created. You can now start using and editing your very first Svelte project using any code editor of your choice.