Setup Vue.js on Linux
Setting up Vue.js on Linux requires Node.js and npm. This guide covers everything from basic setup to professional development environment.
Prerequisites
Install Node.js and NPM
Ubuntu/Debian
sudo apt update
sudo apt install nodejs npmFedora/RHEL
sudo dnf install nodejs npmArch Linux
sudo pacman -S nodejs npmUsing NVM (Recommended)
NVM lets you switch between Node.js versions:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 18
nvm use 18Create Vue.js Project
Using Official Vue CLI
npm create vue@latest my-vue-appYou’ll be prompted with configuration options:
- TypeScript support
- JSX support
- Vue Router for navigation
- Pinia for state management
- Vitest for testing
- ESLint for code quality
Navigate and Setup
cd my-vue-app
npm install
npm run devYour app will be available at http://localhost:5173
Alternative: Vite Template
npm create vite@latest my-vue-app -- --template vue
cd my-vue-app
npm install
npm run devDevelopment Environment
VS Code Setup
Install VS Code using your package manager:
# Ubuntu/Debian
sudo snap install code --classic
# Fedora
sudo dnf install codeInstall essential extensions:
- Volar (Vue language support)
- Vue VSCode Snippets
- Prettier - Code formatter
- ESLint
- Auto Rename Tag
Browser DevTools
Install Vue.js DevTools for your browser:
Advanced Setup
Vue Router Integration
npm install vue-router@4Pinia State Management
npm install piniaVue CLI Global Installation
npm install -g @vue/cli
vue create my-projectCommon Issues
Permission Denied with NPM
# Configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcPort Already in Use
# Kill process on port 5173
sudo lsof -ti:5173 | xargs kill -9Node Version Incompatibility
# Check Vue.js compatibility
nvm install 16
nvm use 16
npm create vue@latestProduction Build
Build for Production
npm run buildPreview Production Build
npm run previewAdditional Tools
Nuxt.js for SSR
Install Nuxt for server-side rendered applications:
npx nuxi init nuxt-app
cd nuxt-app
npm install
npm run devVue Testing Library
npm install --save-dev @vue/test-utils vitest jsdomSources
For other platforms, check our Vue.js macOS setup and Windows Vue installation.