← Back to Vue.js Course | Chapter 1: Introduction | Lesson 3 of 7

Installing Vue

You can add Vue with one script tag, or create a full project with the official scaffolding tool.

In this page:

  1. Installing Vue
Syntax
markup
npm create vue@latest
cd project-name
npm install
npm run dev

Installing Vue

For quick experiments use the CDN. For real projects run npm create vue@latest, which sets up Vite, optional Router, Pinia, testing and linting. Then npm install and npm run dev start a local dev server with hot reload.

Note: Vue projects use Vite by default, which starts almost instantly.

Example: Installing Vue

bash
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
$ npm create vue@latest
✔ Project name: my-vue-app
✔ Add Vue Router? Yes
✔ Add Pinia? Yes
$ cd my-vue-app
$ npm install
$ npm run dev
  VITE v5.2.0  ready in 320 ms
  ➜  Local:   http://localhost:5173/
</body>
</html>

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
Common Mistakes
  1. Using the old Vue CLI for new projects
  2. Forgetting npm install after scaffolding
  3. Running node versions that are too old
Chapter Summary
  • npm create vue@latest scaffolds a project
  • Vite is the dev server
  • npm run dev starts it
  • The CDN needs no tools
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.