In the previous lesson you used Vue by loading it from a CDN in a single HTML file. A real application such as Colmena Bookings needs more than that: an environment that compiles .vue files, reloads the page instantly when you save, flags errors as you type and lets you inspect components in the browser. In this lesson you will set up all of those tools: Node.js, a package manager, Vite, Visual Studio Code with the right extensions, and Vue DevTools. We will finish by going through the questions asked by the Vue project scaffolding tool one by one, so that in the next lesson all you have to do is run it.
Contents
- Overview of the tools
- Node.js: installation and verification
- Node version managers: nvm and fnm
- Package managers: npm and pnpm
- Vite and why it replaces Vue CLI
- Visual Studio Code and the "Vue (Official)" extension
- Vue DevTools in the browser
- The
npm create vue@latestscaffolding tool: its questions explained - Final environment check
- Overview of the tools
Before installing anything, let's look at the role each piece plays:
| Tool | Role | Required? |
|---|---|---|
| Node.js | Runtime for executing JavaScript outside the browser. Vite and the other tools need it | Yes |
| npm / pnpm | Install the project's dependencies (Vue, Vite...) and run its scripts | Yes (npm ships with Node) |
| Vite | Development server and production build tool. It is installed inside each project | Yes (the scaffolding tool installs it) |
| VS Code + Vue (Official) | Editor with syntax highlighting, autocompletion and error detection in .vue files |
Highly recommended |
| ESLint and Prettier | Code error detection and automatic formatting | Recommended |
| Vue DevTools | Inspecting components and state in the browser | Highly recommended |
flowchart LR
N["Node.js"] --> P["npm / pnpm"]
P --> V["Vite (inside the project)"]
V --> B["Browser + Vue DevTools"]
E["VS Code + Vue (Official) + ESLint + Prettier"] --> V
- Node.js: installation and verification
Vue does not need Node.js to run in the browser, but all the development tools do. Always install an LTS (Long Term Support) version: these are the even-numbered releases that are supported for about three years, and they are the ones companies use. Odd-numbered releases are experimental and short-lived.
Recent versions of Vite require a fairly modern version of Node (from the 20 line onwards, in their latest releases). With whichever LTS is active when you take the course, you will have no problems.
There are two ways to install it:
- The official installer from nodejs.org: simple, but switching versions later on is awkward.
- A version manager (recommended for professionals): we cover this in the next section.
Once it is installed, open a new terminal and check the versions:
You should see something like v24.x.x and 11.x.x (the exact numbers will depend on when you install). If the terminal replies "command not found", close the terminal and open it again; if the problem persists, check that the installation has added Node to your PATH.
- Node version managers: nvm and fnm
Over your career you will work on projects that require different versions of Node. A version manager lets you have several installed and switch between them with a single command.
| Manager | Systems | Features |
|---|---|---|
| nvm | macOS and Linux (on Windows there is a separate project, nvm-windows) | The most widely used; written in shell script |
| fnm | Windows, macOS and Linux | Written in Rust, very fast, cross-platform; can switch version automatically when you enter a folder |
Example with nvm (after installing it by following the instructions in its repository):
# Install the latest available LTS version
nvm install --lts
# Use it in the current terminal
nvm use --lts
# List the installed versions
nvm lsThe equivalent example with fnm:
A handy trick: if you create a .nvmrc file at the root of a project containing the version number (for example, 24), anyone on the team can run nvm use (or fnm use) and get the same version. We will do this in Colmena Bookings when we create the project.
- Package managers: npm and pnpm
A package manager downloads the libraries your project depends on (its dependencies), stores them in the node_modules folder and records their exact versions in a lockfile. It also runs the scripts defined in package.json (such as npm run dev).
| Aspect | npm | pnpm |
|---|---|---|
| Installation | Ships with Node.js | Enabled with Corepack (corepack enable pnpm) or npm install -g pnpm |
| Disk space | Copies every dependency into every project | Shared global store with links: takes up far less space |
| Speed | Good | Usually faster |
| Strictness | Lets you use undeclared dependencies (ones that come along "by accident") | Stricter: you can only import what you declare |
| Lockfile | package-lock.json |
pnpm-lock.yaml |
| Commands | npm install, npm run dev |
pnpm install, pnpm dev |
Both are perfectly valid, and the Vue team itself uses pnpm in its repositories. In this course we will use npm because it ships with Node and it is what you will find in almost any documentation. If you prefer pnpm, replace npm with pnpm in the commands. What you must not do is mix the two in the same project: you would end up with two different lockfiles.
- Vite and why it replaces Vue CLI
A browser does not understand .vue files: something has to turn them into ordinary JavaScript and CSS. That is the job of the build tool.
In the Vue 2 era, the official tool was Vue CLI, based on webpack. Today Vue CLI is in maintenance mode and the official documentation recommends Vite (also created by Evan You) for any new project.
Why is Vite so fast? During development it does not bundle the whole application before starting: it serves your code as native ES modules that the browser requests as it needs them, and it transforms only the file being requested. For production, it does generate optimised bundles.
| Aspect | Vue CLI (webpack) | Vite |
|---|---|---|
| Status | Maintenance: no new features | Active; officially recommended |
| Development server start-up | Bundles the whole app before serving it: seconds or minutes on large projects | Almost instant, regardless of size |
| Hot module replacement (HMR) | Slows down as the project grows | Fast and consistent |
| Configuration | vue.config.js on top of webpack |
vite.config.js, simpler |
| Ecosystem | webpack plugins | Vite plugins (compatible with Rollup's); also used by Vitest and Nuxt |
If you inherit a Vue CLI project it will keep working, but you should plan a migration to Vite. You do not need to install Vite globally: the scaffolding tool will add it as a project dependency.
- Visual Studio Code and the "Vue (Official)" extension
You can use any editor, but VS Code is the most widely used with Vue and the one with the best official support.
6.1 Recommended extensions
| Extension | What it does |
|---|---|
Vue (Official) (Vue.volar) |
Syntax highlighting, autocompletion, navigation and type checking in .vue files. It used to be called Volar |
ESLint (dbaeumer.vscode-eslint) |
Shows the errors ESLint detects directly in the editor |
Prettier - Code formatter (esbenp.prettier-vscode) |
Formats the code automatically |
Watch out: if you have the old Vetur extension installed (from the Vue 2 era), disable it for Vue 3 projects: it conflicts with "Vue (Official)".
You can install them from the Extensions panel (Ctrl+Shift+X) or from the terminal:
code --install-extension Vue.volar
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode6.2 ESLint and Prettier: what each one does
- ESLint analyses the code looking for errors and bad practices: unused variables, misspelt Vue directives, a
v-forwithout akey... With the officialeslint-plugin-vueplugin it knows the Vue-specific rules. - Prettier deals only with formatting: indentation, quotes, line breaks. That way the whole team writes in the same style without arguing about it.
They complement each other: ESLint for quality, Prettier for form.
6.3 Recommended settings
Open your user settings in JSON format (Ctrl+Shift+P → "Preferences: Open User Settings (JSON)") and add:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.tabSize": 2,
"files.eol": "\n"
}What each line does:
editor.formatOnSave: formats the file every time you save it.editor.defaultFormatter: Prettier will be the formatter.editor.codeActionsOnSave→source.fixAll.eslint: on save, ESLint automatically fixes whatever it knows how to fix.editor.tabSize: 2: two-space indentation, the usual convention in Vue projects.files.eol:\n: Unix-style line endings, to avoid differences between operating systems in Git.
The specific ESLint and Prettier rules will live in configuration files inside the project itself (the scaffolding tool generates them), so the whole team will share the same ones.
- Vue DevTools in the browser
Vue DevTools is the official debugging tool. It lets you see the component tree, inspect and modify component state live, follow events, view routes and stores, and measure performance.
There are two ways to use it:
| Option | How to get it | When to use it |
|---|---|---|
| Browser extension | From the Chrome, Edge or Firefox extension store (search for "Vue.js devtools" published by the Vue team) | Always; it works with any Vue app in development mode, including the CDN one from the previous lesson |
Vite plugin (vite-plugin-vue-devtools) |
Added by the scaffolding tool in recent versions of generated projects | Embeds the DevTools in the development page itself, with no extension |
Install the extension now. To check that it works, open the room.html file from the previous lesson, press F12 and look for the Vue tab. If the file is opened from disk (file://), you may need to allow the extension access to file URLs in its settings.
Vue DevTools only works with applications in development mode. On a website built for production, the extension will report that it cannot detect Vue or that it is disabled: this is expected.
- The
npm create vue@latest scaffolding tool: its questions explained
npm create vue@latest scaffolding tool: its questions explainedTo create a Vue project you use the official create-vue tool, which you run with npm create vue@latest. The @latest suffix guarantees that the latest version of the tool is always downloaded.
The tool asks several questions. Depending on its version, it presents them one at a time (Yes/No answers) or as a list of checkboxes that you tick with the space bar; the content is the same. This table explains each option and how we will answer for Colmena Bookings:
| Question / option | What it adds to the project | Answer for Colmena | Why |
|---|---|---|---|
| Project name | Name of the folder and the package | colmena-bookings |
We will pass it directly in the command |
| TypeScript | Configuration for writing in TypeScript | No | We will work in JavaScript and add TypeScript in Vue with TypeScript |
| JSX | Support for writing components with JSX | No | We will cover it in Render Functions and JSX |
| Router (Vue Router) | Router and example views | No | We will install it by hand in module 4 to understand each step |
| Pinia | State management and an example store | No | We will look at Vuex first and then integrate Pinia in 05-06 |
| Vitest | Unit tests and an example test | No | We will set it up in module 8 |
| End-to-End Testing | End-to-end tests (Playwright, Cypress or Nightwatch) | No | We will add Cypress in 08-04 |
| ESLint | Error detection with Vue rules | Yes | We want help against errors from day one |
| Prettier | Automatic code formatting | Yes | Consistent formatting from the start |
In short: only ESLint and Prettier. We could tick everything and get a complete project in one go, but then you would not know what each piece does or how it connects to the rest. By adding each tool by hand in its own module you will learn how to integrate it, which is something you will need when you work on existing projects.
Some versions of the tool show additional questions:
- Experimental features (for example, alternative linters or bundlers): answer "No"; we prefer stable tools.
- Skip the example code ("blank project"): answer "No". In the next lesson we will look at the example to understand the structure and then clean it up ourselves.
- Vue DevTools: some versions ask whether to add the DevTools plugin for Vite. If this appears, answer "Yes".
- Final environment check
Before moving on to the next lesson, make sure everything is ready:
# 1. Node.js, LTS version
node --version
# 2. npm available
npm --version
# 3. Git (we will use it to version the project)
git --version
# 4. VS Code extensions installed
code --list-extensions | grep -i -E "volar|eslint|prettier"On Windows with PowerShell, replace the last command with code --list-extensions | Select-String -Pattern "volar|eslint|prettier".
Checklist:
- [ ]
node --versionshows a recent LTS version. - [ ]
npm --versionresponds without errors. - [ ] VS Code has Vue (Official), ESLint and Prettier, and Vetur is disabled.
- [ ] Your VS Code settings include format on save.
- [ ] The Vue DevTools extension appears in the browser and detects the app in
room.html. - [ ] You know how to answer each question asked by
npm create vue@latest.
Common Mistakes and Tips
- Installing an odd-numbered version of Node (for example, "Current"). It may work, but some tools do not officially support it. Use the LTS.
- Installing packages with
sudoon Linux or macOS. It causes permission problems. With a version manager such as nvm or fnm you do not need it. - Having Vetur and Vue (Official) enabled at the same time. You will see false errors and duplicated autocompletion.
- Formatting that "does nothing" on save. Check that Prettier is the default formatter; if you have several formatters installed, VS Code may be using a different one.
- Following tutorials that use
vue create. That is the Vue CLI command. For new projects, usenpm create vue@latest. - Tip: store each project's Node version in a
.nvmrcfile. It will save you from hard-to-diagnose errors when you switch between projects.
Exercises
Exercise 1. Using nvm or fnm, install two different LTS versions of Node (for example, the current one and the previous one), switch between them and check the output of node --version each time. Then leave the most recent one active.
Exercise 2. A colleague asks you why we did not tick Router and Pinia in the scaffolding tool for Colmena Bookings if "we're going to use them in the end anyway". Write a short, well-argued reply.
Exercise 3. Create a scratch folder containing a badly formatted sample.js file like the one below and check that Prettier reformats it when you save it in VS Code:
Solutions
Solution 1. With nvm:
nvm install --lts # installs the most recent LTS
nvm install 22 # installs, for example, the 22 line
nvm use 22 && node --version
nvm use --lts && node --version
nvm alias default lts/* # the most recent LTS becomes the default in new terminalsWith fnm, the equivalent commands are fnm install 22, fnm use 22 and fnm default lts-latest.
Solution 2. One possible answer: "If the scaffolding tool generates everything, we get a project that works, but we don't know which files each option created or how they fit together. By adding Vue Router and Pinia by hand in their modules, we'll learn how to install them, register them with app.use and organise their files, which is exactly what we'll need when we add these tools to an existing project."
Solution 3. After saving, the file should look like this (with Prettier's default configuration, which uses double quotes and semicolons; in the real project, the configuration generated by the scaffolding tool may change these details):
If nothing changes, check editor.formatOnSave and editor.defaultFormatter, and make sure the Prettier extension is installed and enabled.
Conclusion
You now have a professional environment: Node.js in an LTS version (ideally managed with nvm or fnm), a package manager (npm in this course), VS Code with Vue (Official), ESLint and Prettier configured to format and fix on save, and Vue DevTools in the browser. You also know why Vite has replaced Vue CLI and what each question asked by npm create vue@latest means, as well as the course's decision for Colmena Bookings: only ESLint and Prettier, with everything else added by hand.
In the next lesson, Creating Your First Vue Application, we will finally run the scaffolding tool, start the development server and walk through the structure of the colmena-bookings project until we make our first change.
Vue.js Course
Module 1: Introduction to Vue.js
- What Is Vue.js?
- Setting Up the Development Environment
- Creating Your First Vue Application
- Understanding the Vue Instance: Application, Components and Lifecycle
- Options API and Composition API: Two Ways to Write Components
Module 2: Vue.js Basics
- Template Syntax
- Reactivity: ref and reactive
- Data Binding
- Event Handling
- Computed Properties and Watchers
- Class and Style Bindings
- Conditional Rendering
- List Rendering
- Forms with v-model
Module 3: Vue.js Components
- Introduction to Components
- Props and Custom Events
- v-model on Your Own Components
- Slots
- Template Refs and Fallthrough Attributes
- Dynamic and Async Components
- Component Communication
Module 4: Vue Router
- Introduction to Vue Router
- Setting Up Vue Router
- Dynamic Routes
- Nested Routes
- Programmatic Navigation and Query Parameters
- Navigation Guards
Module 5: State Management with Vuex and Pinia
- Introduction to Vuex
- State, Getters, Mutations and Actions
- Vuex Modules
- Using Vuex in Components
- Advanced Vuex Patterns
- Pinia: The Recommended State Management for Vue 3
- Migrating from Vuex to Pinia
Module 6: Vue.js Directives
Module 7: Vue.js Plugins
Module 8: Testing in Vue.js
- Unit Testing with Vue Test Utils and Vitest
- Mocking Dependencies
- Testing Composables and Stores
- End-to-End Testing with Cypress
Module 9: Advanced Vue.js Concepts
- The Vue 3 Composition API in Depth: Composables and Logic Reuse
- Vue with TypeScript
- Render Functions and JSX
- Transitions and Animations
- Teleport, Suspense and Error Handling
- Server-Side Rendering (SSR) with Nuxt
- Performance Optimization
