This guide walks you through setting up Svelte, installing dependencies, and deploying your project efficiently.
Before starting, ensure you have Node.js installed. We recommend using NVM (Node Version Manager) for flexibility.
Run the following command in your terminal to install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
After installation, restart your terminal or run:
source ~/.bashrc # For Linux users
source ~/.zshrc # For macOS users (if using Zsh)
To install Node.js (e.g., version 18), run:
nvm install 18
To use the installed version:
nvm use 18
To set Node.js 18 as the default version for all new terminals:
nvm alias default 18
npx sv
Run the following commands:
npx sv create myapp
cd myapp
npm install
npm run dev
Your development server will start at http://localhost:5173/
.
Once your project is ready, deploy it using Vercel, Surge, or Netlify.
Install Vercel CLI:
npm install -g vercel
Deploy your project:
cd public
vercel deploy --name my-project
Install Surge CLI:
npm install -g surge
Build and deploy:
npm run build
surge public my-project.surge.sh
Install Netlify CLI:
npm install -g netlify-cli
Deploy your project:
netlify deploy