FAQ
Frequently asked questions and solutions for the Antdv Next Admin project.
Table of Contents
- Installation Issues
- Development Environment Issues
- Routing Issues
- Permission Issues
- Mock Data Issues
- Build and Deployment Issues
- TypeScript Issues
- Performance Tips
Installation Issues
Q: Installation stuck or timeout
Solution:
bash
# Use domestic mirror
npm config set registry https://registry.npmmirror.com
# Or use pnpm
pnpm installDevelopment Environment Issues
Q: White screen after starting dev server
Possible causes and solutions:
- Port occupied
bash
# Change port
npm run dev -- --port 3001- Environment variables not applied
bash
# Restart dev server after modifying .env- Browser cache
bash
# Force refresh: Cmd/Ctrl + Shift + RQ: Hot reload (HMR) not working
Solution:
bash
# Restart dev server
# Check browser console for WebSocket connection errorsRouting Issues
Q: 404 after page refresh
Reason: Frontend uses history mode, requires server configuration
Solution:
Nginx:
nginx
location / {
try_files $uri $uri/ /index.html;
}Q: Menu not showing after adding new page
Checklist:
- Route added to
routes.ts - Route meta has
titleset - Have permission to access
- Re-login (permission routes need regeneration)
Q: KeepAlive caching not working
Possible causes:
typescript
// Check route config
{
meta: {
keepAlive: true,
title: 'Page Title'
}
}
// Check component name matches route name
export default {
name: 'Dashboard',
}Permission Issues
Q: Permission directive not working
Troubleshooting:
typescript
// Check permission code
<a-button v-permission="'user.create'">Add</a-button>
// Check user permissions
const authStore = useAuthStore()
console.log(authStore.userPermissions)
// Ensure user is logged in
console.log(authStore.isLoggedIn)Mock Data Issues
Q: Mock API not working
Troubleshooting:
- Check environment variable
bash
VITE_USE_MOCK=true- Check API URL
typescript
// Must start with /api
request.get('/api/users') // Correct
request.get('/users') // Wrong- Restart dev server
Build and Deployment Issues
Q: Build failed
Common errors:
- TypeScript errors
bash
npm run type-check- Out of memory
bash
export NODE_OPTIONS=--max-old-space-size=4096
npm run buildQ: 404 for resources after deployment
Possible causes:
- Wrong base path
typescript
export default {
base: '/admin/', // For subdirectory deployment
}- Server configuration
Q: White screen after deployment
Troubleshooting:
- Check browser console errors
- Check network requests
- Verify environment variables
bash
VITE_API_BASE_URL=https://api.example.comTypeScript Issues
Q: Cannot find module
Solution:
json
// tsconfig.json
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}Restart VS Code or TypeScript service.
Performance Tips
1. First Screen Loading
typescript
// vite.config.ts
export default {
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'vue-router', 'pinia'],
antdv: ['antdv-next'],
},
},
},
},
}2. Component Lazy Loading
typescript
const Dashboard = () => import('@/views/dashboard/index.vue')3. Prevent Memory Leaks
typescript
// Clean up timers
onUnmounted(() => {
clearInterval(timer)
})
// Clean up event listeners
onUnmounted(() => {
window.removeEventListener('resize', handleResize)
})Getting Help
- Read Documentation - Carefully read the relevant module documentation
- Check Examples - Reference examples in
src/views/examples/ - Search Issues - Look for similar issues on GitHub
- Submit Issue - If unresolved, submit an issue with:
- Problem description
- Reproduction steps
- Error screenshots or logs
- Environment info
Next Steps
- View Development Workflow
- Learn API Integration
- Read Examples
