Setup Nuxt/Vue/TypeScript project. Use when user needs to install dependencies, prepare Nuxt, setup LSP, or fix TypeScript errors in a Nuxt/Vue project. Works in both main repo and worktrees.
Complete setup workflow for Nuxt 3 projects - from fresh clone to working LSP with full TypeScript support.
Announce at start: "I'm using the nuxt-setup skill to prepare this project."
# 1. Detect package manager and install deps
yarn install # or npm/pnpm based on lockfile
# 2. Prepare Nuxt (generates .nuxt types)
npx nuxt prepare
# 3. Verify TypeScript
npx vue-tsc --noEmit
Auto-detect from lockfile:
| File | Package Manager |
|---|---|
yarn.lock |
yarn |
package-lock.json |
npm |
pnpm-lock.yaml |
pnpm |
bun.lockb |
bun |
# Detection logic
if [ -f yarn.lock ]; then
PM="yarn"
elif [ -f pnpm-lock.yaml ]; then
PM="pnpm"
elif [ -f bun.lockb ]; then
PM="bun"
else
PM="npm"
fi
# Yarn (check .yarnrc.yml for version)
yarn install
# NPM
npm install
# PNPM
pnpm install
# Bun
bun install
Common issues:
.yarnrc.yml for nodeLinker setting.nvmrc or engines in package.jsonnpx nuxt prepare
This generates:
.nuxt/ directory.nuxt/tsconfig.json - TypeScript paths.nuxt/types/ - Auto-imports, components, composables typesMust run after:
nuxt.config.ts# Full type check
npx vue-tsc --noEmit
# Quick check specific file
npx vue-tsc --noEmit path/to/file.vue
Required extensions:
Vue.volar)Settings (.vscode/settings.json):
{
"typescript.tsdk": "node_modules/typescript/lib",
"vue.server.hybridMode": true
}
Mason install:
:MasonInstall vue-language-server typescript-language-server
LSP config:
require('lspconfig').volar.setup({
filetypes = { 'vue', 'typescript', 'javascript' },
init_options = {
vue = {
hybridMode = true,
},
},
})
Verify setup:
# Check if types resolve
npx vue-tsc --noEmit 2>&1 | head -20
# Regenerate types
rm -rf .nuxt
npx nuxt prepare
The #imports alias is generated by Nuxt. Fix:
npx nuxt prepare
# Regenerate component types
npx nuxt prepare
Check tsconfig.json extends .nuxt/tsconfig.json:
{
"extends": "./.nuxt/tsconfig.json"
}
Add to tsconfig.json:
{
"compilerOptions": {
"skipLibCheck": true
}
}
# Use workspace TypeScript
# VS Code: Cmd+Shift+P → "TypeScript: Select TypeScript Version" → "Use Workspace Version"
When setting up a worktree:
# 1. After worktree creation, cd into it
cd .worktrees/<branch-name>
# 2. Install dependencies (node_modules not shared)
yarn install
# 3. Prepare Nuxt (types not shared)
npx nuxt prepare
# 4. Verify
npx vue-tsc --noEmit
Note: Each worktree needs its own node_modules and .nuxt directory.
# Check required env vars
cat .env.example
# Copy and fill
cp .env.example .env
Nuxt uses runtimeConfig in nuxt.config.ts. Check for required env vars:
grep -A20 "runtimeConfig" nuxt.config.ts
# Development server
npx nuxt dev
# Production build
npx nuxt build
# Preview production
npx nuxt preview
| File | Purpose |
|---|---|
nuxt.config.ts |
Nuxt configuration |
tsconfig.json |
TypeScript config (extends .nuxt/tsconfig.json) |
.nuxt/ |
Generated types and build artifacts |
app.vue |
Root component |
pages/ |
File-based routing |
components/ |
Auto-imported components |
composables/ |
Auto-imported composables |
server/ |
Nitro server routes |
| Issue | Solution |
|---|---|
| Missing types | npx nuxt prepare |
| Module not found | yarn install && npx nuxt prepare |
| LSP not working | Restart LSP, check tsconfig extends .nuxt |
| Auto-imports broken | rm -rf .nuxt && npx nuxt prepare |
| Wrong TS version | Select workspace TypeScript in editor |
| Worktree setup | Install deps + nuxt prepare in worktree |
Never:
nuxt prepare after clonenode_modules between worktrees (symlinks break).nuxt/tsconfig.json in project tsconfigAlways:
nuxt prepare after config changes