Skip to main content

Overview

This guide covers common issues you may encounter and their solutions. For issues not covered here, check the application logs or contact support.

Installation Issues

Port Already in Use

Problem: Development server fails to start with “Port 5173 already in use” error. Solution:
1

Identify Process

Find what’s using the port:
# Linux/Mac
lsof -i :5173

# Windows
netstat -ano | findstr :5173
2

Kill Process

Stop the conflicting process or change the port in vite.config.ts:10:
server: {
  host: "::",
  port: 3000, // Use different port
}

Module Not Found Errors

Problem: Getting “Cannot find module” errors after installation. Solutions:
Remove and reinstall dependencies:
rm -rf node_modules package-lock.json
npm install

TypeScript Errors

Problem: TypeScript compilation errors during build. Solutions:
Ensure TypeScript 5.8.3 or higher:
npx tsc --version
If version is wrong:
npm install -D [email protected]
Check that tsconfig.json includes correct paths:
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
Restart your IDE/editor:
  • VS Code: Reload window (Ctrl+Shift+P → “Reload Window”)
  • Restart TypeScript server
  • Clear editor cache
Run TypeScript compiler check:
npx tsc --noEmit
This shows all type errors without building.

Authentication Issues

Unable to Login

Problem: Login fails with “Invalid credentials” error. Checklist:
Username and password are correct (case-sensitive)
Backend API is running and accessible
VITE_API_BASE_URL is configured correctly in .env
Network connection is stable
No CORS errors in browser console
Debug Steps:
1

Check API Connection

Open browser DevTools (F12) → Network tabLook for the login request:
  • Status should be 200 (success)
  • If 401: Wrong credentials
  • If 404: Wrong API URL
  • If 500: Backend error
2

Verify Environment Variable

Check that API URL is loaded:
console.log(import.meta.env.VITE_API_BASE_URL);
Should output your API URL, not undefined.
3

Test API Directly

Use curl to test authentication:
curl -X POST https://your-api.com/api/v1/auth/login \
  -H "Authorization: Basic $(echo -n 'username:password' | base64)" \
  -H "Content-Type: application/json"

Registration Failed

Problem: Cannot register new user. Common Causes:
Error: “Este correo no está autorizado para registrarse”Solution:
  • Contact system administrator to add email to whitelist
  • Check backend whitelist configuration
  • Verify email is spelled correctly
Error: “La contraseña debe tener al menos 8 caracteres”Solution:
  • Use password with minimum 8 characters
  • Include uppercase, lowercase, numbers, and symbols for stronger password
  • Check password strength indicator
Error: “Las contraseñas no coinciden”Solution:
  • Ensure “Password” and “Confirm Password” fields match exactly
  • Check for extra spaces or hidden characters
Error: Username is already takenSolution:
  • Choose a different username
  • Contact admin if you believe this is an error

Session Expired

Problem: Automatically logged out unexpectedly. Causes:
  • Idle timeout: 15 minutes of inactivity (src/components/auth/IdleHandler.tsx:21)
  • Browser closed: Session storage is cleared
  • Manual logout: User clicked logout
Solution:
  • Simply log in again
  • Stay active to prevent timeout
  • Consider implementing “remember me” feature

API Connection Issues

CORS Errors

Problem: Browser shows CORS policy errors in console.
Access to fetch at 'https://api.example.com' from origin 'http://localhost:5173' 
has been blocked by CORS policy
Solution: Configure CORS on your backend:
const cors = require('cors');

app.use(cors({
  origin: 'http://localhost:5173',
  credentials: true,
  methods: ['GET', 'POST', 'PUT', 'DELETE'],
  allowedHeaders: ['Authorization', 'Content-Type']
}));

Network Request Failed

Problem: All API requests fail with network error. Debug Checklist:
1

Check Backend Status

Verify backend server is running:
curl https://your-api.com/api/v1/health
2

Verify API URL

Check .env file:
cat .env
# Should show: VITE_API_BASE_URL=https://your-api.com/api/v1
3

Test Connectivity

Ping the server:
ping your-api.com
4

Check Firewall

Ensure firewall allows connections:
  • Backend port is open
  • No VPN blocking requests
  • Corporate firewall configured

Build Issues

Build Fails

Problem: Production build fails with errors. Solutions:
Error: JavaScript heap out of memorySolution: Increase Node.js memory:
# Linux/Mac
NODE_OPTIONS="--max-old-space-size=4096" npm run build

# Windows
set NODE_OPTIONS=--max-old-space-size=4096 && npm run build
Error: Build fails due to linting errorsSolution:
  1. Fix linting errors:
    npm run lint
    
  2. Or temporarily disable linting in build:
    package.json
    "build": "vite build --mode production --no-lint"
    
Error: Cannot resolve module importsSolution:
  1. Check import paths use @/ alias correctly
  2. Verify files exist at import locations
  3. Check file extensions (.tsx, .ts, .jsx, .js)
  4. Ensure proper casing (case-sensitive)

Build Size Too Large

Problem: Bundle size exceeds recommended limits. Solutions:
1

Analyze Bundle

Use bundle analyzer:
npm install -D rollup-plugin-visualizer
npm run build
Add to vite.config.ts:
import { visualizer } from 'rollup-plugin-visualizer';

plugins: [
  react(),
  visualizer({ open: true })
]
2

Code Splitting

Use dynamic imports for large components:
const HeavyComponent = lazy(() => import('./HeavyComponent'));
3

Optimize Dependencies

  • Remove unused dependencies
  • Use lighter alternatives
  • Tree-shake properly

Runtime Issues

White Screen / App Won’t Load

Problem: Application shows blank screen. Debug Steps:
1

Check Browser Console

Open DevTools (F12) → Console tabLook for:
  • JavaScript errors
  • Failed network requests
  • Missing files (404 errors)
2

Verify Build

Check that dist/ folder contains:
  • index.html
  • assets/ folder with JS and CSS files
If missing, rebuild:
npm run build
3

Check Base Path

If deploying to subdirectory, configure base in vite.config.ts:
export default defineConfig({
  base: '/subdirectory/',
  // ...
})

Performance Issues

Problem: Application is slow or unresponsive. Optimization Checklist:
Enable production build (not development)
Minimize re-renders with React.memo
Use virtualization for long lists
Optimize images (compress, lazy load)
Enable code splitting
Cache API responses with TanStack Query
Profiling:
// Record performance profile
// DevTools → Performance → Record
// Perform slow action
// Stop recording and analyze

Data Issues

Data Not Updating

Problem: Changes don’t appear after saving. Checklist:
1

Check Network Request

  • Open DevTools → Network
  • Verify request was sent
  • Check response status (should be 200)
  • Confirm response data
2

Verify State Management

  • Check TanStack Query is invalidating cache
  • Confirm mutations are configured correctly
  • Look for stale data indicators
3

Force Refresh

  • Try hard refresh (Ctrl+Shift+R)
  • Clear browser cache
  • Check backend database directly

Export Not Working

Problem: Excel export fails or downloads empty file. Solutions:
Verify file-saver is installed:
npm list file-saver
If missing:
npm install file-saver @types/file-saver
  • Ensure browser supports Blob API
  • Check pop-up blocker isn’t preventing download
  • Try different browser
  • Verify there’s data to export
  • Check date range filter
  • Confirm API returned data

Environment Issues

Environment Variables Not Loading

Problem: import.meta.env.VITE_API_BASE_URL returns undefined. Solutions:
1

Check File Name

File must be named exactly .env (with leading dot)
2

Verify Variable Prefix

All variables must start with VITE_:
# ✅ Correct
VITE_API_BASE_URL=https://api.com

# ❌ Wrong - won't be exposed to client
API_BASE_URL=https://api.com
3

Restart Dev Server

Environment changes require server restart:
# Stop server (Ctrl+C)
npm run dev
4

Check File Location

.env must be in project root (same level as package.json)

Getting Help

Debugging Tools

Browser DevTools:
  • Console: View errors and logs
  • Network: Monitor API requests
  • Application: Check storage (sessionStorage)
  • Sources: Debug JavaScript
  • Performance: Profile slow operations
React DevTools:
  • Component inspection
  • Props and state viewing
  • Performance profiling
  • Hook debugging

Log Files

Check logs for errors: Development:
  • Browser console
  • Terminal running npm run dev
Production:
  • Server logs
  • Error monitoring service (Sentry, etc.)
  • Browser console (if accessible)

Common Error Messages

Cause: Network request failedCheck:
  • Backend is running
  • API URL is correct
  • CORS is configured
  • Network connectivity
Cause: Accessing property on undefined/null objectCheck:
  • Optional chaining: user?.name
  • Null checks before access
  • API response structure
  • Loading states
Cause: Syntax error in JavaScript/JSONCheck:
  • Missing/extra commas
  • Unclosed brackets/braces
  • Invalid JSON in API response
  • File encoding (should be UTF-8)

Support Resources

Installation Guide

Review installation steps

Configuration

Check configuration settings

Environment Setup

Verify environment variables

User Management

Authentication troubleshooting
If your issue isn’t covered here, check the browser console for specific error messages and review the relevant documentation sections.

Build docs developers (and LLMs) love