What Causes This Error?
This error occurs when you run nuxi (Nuxt CLI) with a command that doesn’t exist or is misspelled.
The Problem
# ❌ Wrong - misspelled command
npx nuxi devlop
# ❌ Wrong - old Nuxt 2 command
npx nuxi generate
# ❌ Wrong - non-existent command
npx nuxi start-server
The Fix
Use Correct Commands
# ✅ Correct commands
npx nuxi dev # Start development server
npx nuxi build # Build for production
npx nuxi preview # Preview production build
npx nuxi prepare # Generate types
npx nuxi info # Show project info
npx nuxi analyze # Analyze bundle
npx nuxi cleanup # Clean up generated files
Available Nuxi Commands
Development
# Start dev server
npx nuxi dev
# With specific port
npx nuxi dev --port 3001
# With specific host
npx nuxi dev --host 0.0.0.0
# Open browser automatically
npx nuxi dev --open
# With HTTPS
npx nuxi dev --https
Building
# Build for production
npx nuxi build
# Static generation (prerender all routes)
npx nuxi generate
# Analyze bundle size
npx nuxi analyze
Preview & Production
# Preview production build locally
npx nuxi preview
# With specific port
npx nuxi preview --port 3001
Development Tools
# Generate TypeScript types
npx nuxi prepare
# Clean generated files (.nuxt, .output)
npx nuxi cleanup
# Show environment info
npx nuxi info
# Upgrade Nuxt
npx nuxi upgrade
# Upgrade with force
npx nuxi upgrade --force
Module Development
# Add a module
npx nuxi module add <module-name>
# Create new module
npx nuxi init -t module my-module
Project Initialization
# Create new project
npx nuxi init my-app
# With specific template
npx nuxi init my-app -t v3
Common Mistakes
Nuxt 2 vs Nuxt 3 Commands
| Nuxt 2 | Nuxt 3 |
|---|---|
nuxt | nuxi dev |
nuxt build | nuxi build |
nuxt generate | nuxi generate |
nuxt start | nuxi preview |
Case Sensitivity
# ❌ Wrong
npx nuxi Dev
npx nuxi BUILD
# ✅ Correct (lowercase)
npx nuxi dev
npx nuxi build
Missing npx
# ❌ Won't work unless globally installed
nuxi dev
# ✅ Use npx for local installation
npx nuxi dev
# ✅ Or use npm scripts
npm run dev # if configured in package.json
Package.json Scripts
Set up npm scripts for convenience:
{
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate",
"preview": "nuxi preview",
"postinstall": "nuxi prepare",
"analyze": "nuxi analyze",
"cleanup": "nuxi cleanup"
}
}
Then use:
npm run dev
npm run build
npm run preview
Getting Help
# Show all commands
npx nuxi --help
npx nuxi -h
# Show help for specific command
npx nuxi dev --help
npx nuxi build --help
Environment Variables
# Pass environment variables
NODE_ENV=production npx nuxi build
# Use .env file (automatic)
npx nuxi dev # Loads .env
# Specify env file
npx nuxi dev --dotenv .env.local
Debug Mode
# Enable debug logging
DEBUG=nuxt:* npx nuxi dev
# Specific debug scopes
DEBUG=nuxt:vite npx nuxi dev
DEBUG=nitro:* npx nuxi build
Troubleshooting
Command Not Found
# If nuxi isn't found, install nuxt
npm install nuxt
# Or check if in node_modules
ls node_modules/.bin/nuxi
Wrong Node Version
# Check Node version
node --version
# Nuxt 3 requires Node 18+
nvm use 18
Corrupted Installation
# Clean reinstall
rm -rf node_modules
rm package-lock.json
npm install
Quick Reference
| Command | Description |
|---|---|
nuxi dev | Development server |
nuxi build | Production build |
nuxi generate | Static site generation |
nuxi preview | Preview production |
nuxi prepare | Generate types |
nuxi info | Show project info |
nuxi cleanup | Clean generated files |
nuxi upgrade | Upgrade Nuxt |
nuxi analyze | Bundle analysis |
nuxi init | Create new project |
nuxi add | Add components/pages |
nuxi module | Module management |
Quick Checklist
- Check spelling of command
- Use lowercase commands
- Use
npx nuxior npm scripts - Run
nuxi --helpfor available commands - Check Node.js version (18+)
- Verify nuxt is installed