Vue Project Scaffolding (create-vue)
create-vue is the official and recommended command-line interface (CLI) tool for quickly scaffolding new Vue.js projects. Currently at stable version 3.22.2, it is actively maintained by the Vue.js core team with frequent releases to align with Vue, Vite, and ecosystem updates. Its primary differentiator from the legacy Vue CLI is its foundation on Vite, providing a significantly faster development experience through rapid cold starts and instant Hot Module Replacement (HMR). Unlike Vue CLI, create-vue primarily acts as a scaffolding utility, generating a pre-configured project and then delegating subsequent operations to Vite, allowing projects to fully leverage the Vite plugin ecosystem. Since v3.22.0, it defaults to generating TypeScript projects, reflecting the modern Vue development landscape.
Common errors
-
npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/create-vue npm ERR! 404 npm ERR! 404 'create-vue@latest' is not in the npm registry.
cause This error often occurs when the `@latest` or `@legacy` tag is omitted, or an outdated local npm cache is used, preventing resolution to the correct package version.fixEnsure you specify the tag: `npm create vue@latest` (for Vue 3) or `npm create vue@legacy` (for Vue 2). If the issue persists, clear your npm cache with `npm cache clean --force`. -
SyntaxError: Cannot use import statement outside a module
cause `create-vue` is a command-line interface (CLI) tool, not a JavaScript/TypeScript library intended for direct programmatic import into application code.fix`create-vue` is executed via `npm create vue@latest` or `npx create-vue@latest` in your terminal. Do not attempt to import it into your JavaScript/TypeScript files. -
Error: Cannot find module 'typescript' or similar TypeScript compilation errors in a seemingly JavaScript project.
cause Since `create-vue` v3.22.0, new projects default to TypeScript. If you intended a JavaScript project but didn't explicitly opt out, TypeScript files and configurations will be present.fixIf a JavaScript project is desired, ensure to explicitly opt out of TypeScript during scaffolding: `npm create vue@latest -- --no-typescript`. For existing projects, you will need to manually remove TypeScript configurations and dependencies. -
The 'engines.node' field is not supported. Please use the 'engines' field in your package.json.
cause This is a generic npm error, but often related to Node.js version incompatibility. While `create-vue` itself specifies engines, if your Node.js version is outside the supported range, it could manifest as various installation issues.fixCheck the `engines.node` requirement for `create-vue` (e.g., `^20.19.0 || >=22.12.0`). Update your Node.js version using a tool like `nvm` to meet the package's requirements.
Warnings
- breaking Starting with version 3.22.0, `create-vue` now generates TypeScript projects by default. Projects scaffolded without explicitly opting out of TypeScript will automatically include `.ts` files and a `tsconfig.json`.
- gotcha Always specify `@latest` or `@legacy` when running `npm create vue` to ensure you get the current or correct Vue 2 version. Omitting the tag may result in npm resolving to a cached and outdated package version.
- deprecated Vue 2 has officially reached End of Life (EOL). While `create-vue@legacy` can still scaffold Vue 2 projects, it is strongly recommended to use Vue 3 for all new projects due to the lack of official support, security updates, and continued development for Vue 2.
- breaking Nightwatch support was dropped in `create-vue` version 3.22.1. Projects scaffolded with versions 3.22.1 or later will no longer offer Nightwatch as an option for end-to-end testing.
- gotcha The `create-vue` package requires Node.js version `^20.19.0` or `>=22.12.0`. Using an older or unsupported Node.js version may lead to installation errors or unexpected behavior during project scaffolding.
- gotcha PowerShell users must quote the double dashes (`--`) when passing feature flags or options to `create-vue` via `npm create`. Forgetting to quote can lead to parsing errors.
Install
-
npm install create-vue -
yarn add create-vue -
pnpm add create-vue
Imports
- CLI Tool
import { createVue } from 'create-vue'npx create-vue@latest
Quickstart
npm create vue@latest my-vue-app # Follow the interactive prompts to select features (TypeScript, Router, Pinia, etc.) cd my-vue-app npm install npm run dev # Alternatively, for a non-interactive setup with common features: npm create vue@latest my-ts-app -- --typescript --router --pinia --vitest --playwright --eslint --prettier --git --force