Troubleshooting Guide
Common issues and solutions for AsseTrack
Installation Issues
Node.js Installation Problems
Symptoms: "node: command not found", "npm: command not found"
Solution: Verify Node.js installation and PATH configuration
- Check if Node.js is installed:
node --version
- If not installed, follow the platform-specific installation guide
- Verify PATH environment variable includes Node.js directory
- Restart terminal/command prompt after installation
- On Windows, ensure "Add to PATH" was selected during installation
MySQL Connection Issues
Symptoms: "ECONNREFUSED", "Access denied", "Can't connect to MySQL server"
Solution: Check MySQL service and credentials
- Verify MySQL is running:
sudo systemctl status mysql
(Linux) or check Services (Windows) - Check database credentials in .env file
- Test connection:
mysql -u root -p
- Ensure database exists:
CREATE DATABASE assettrack_db;
- Check firewall settings if using remote database
NPM Install Permission Errors
Symptoms: "EACCES: permission denied", "npm ERR! code EACCES"
Solution: Fix npm permissions or use alternative methods
- On Linux/macOS:
sudo chown -R $(whoami) ~/.npm
- Or use nvm to manage Node.js versions
- On Windows, run Command Prompt as Administrator
- Clear npm cache:
npm cache clean --force
- Delete node_modules and package-lock.json, then reinstall
Server Issues
Port Already in Use
Symptoms: "EADDRINUSE: address already in use :::3000"
Solution: Find and kill the process using the port
- Find process using port 3000:
lsof -i :3000
(macOS/Linux) ornetstat -ano | findstr :3000
(Windows) - Kill the process:
kill -9 PID
(macOS/Linux) ortaskkill /PID PID /F
(Windows) - Or change the port in .env file:
PORT=3001
- Update client configuration to match new port
Database Migration Failures
Symptoms: "Migration failed", "Table already exists", "Sequelize errors"
Solution: Reset and recreate database
- Check database connection in .env file
- Reset database:
npm run db:reset
- Or manually drop and recreate database
- Run migrations:
npm run db:migrate
- Seed data:
npm run db:seed
JWT Authentication Issues
Symptoms: "Invalid token", "jwt malformed", "Unauthorized"
Solution: Check JWT configuration and secret
- Verify JWT_SECRET in .env file is set and secure
- Ensure JWT_SECRET is at least 32 characters long
- Check JWT_EXPIRES_IN format (e.g., "24h", "7d")
- Clear browser cookies and local storage
- Restart server after changing JWT settings
Client Issues
Client Not Loading
Symptoms: Blank page, "Cannot GET /", build errors
Solution: Check build process and server configuration
- Verify client dependencies:
npm install
- Check if server is running on correct port
- Update API configuration in
src/config/config.ts
- Clear browser cache and hard refresh (Ctrl+F5)
- Check browser console for JavaScript errors
CORS Errors
Symptoms: "CORS policy", "Access-Control-Allow-Origin", "blocked by CORS"
Solution: Configure CORS settings in server
- Check ALLOWED_ORIGINS in server .env file
- Add client URL to allowed origins:
http://localhost:5000
- Restart server after changing CORS settings
- For production, use HTTPS URLs
- Check if client and server are on different ports
File Upload Issues
Symptoms: "File too large", "Upload failed", "Permission denied"
Solution: Check file size limits and permissions
- Check MAX_FILE_SIZE in .env file (in bytes)
- Verify upload directory exists and is writable
- Check disk space on server
- Ensure file types are allowed
- Check server logs for detailed error messages
Performance Issues
Slow Application Performance
Symptoms: Slow page loads, timeouts, high memory usage
Solution: Optimize database and server configuration
- Check database query performance
- Add database indexes for frequently queried fields
- Increase server memory allocation
- Use PM2 for process management
- Enable database query caching
- Optimize images and static assets
Memory Leaks
Symptoms: Increasing memory usage, server crashes
Solution: Monitor and fix memory leaks
- Monitor memory usage:
pm2 monit
- Check for unclosed database connections
- Review code for memory leaks in event listeners
- Set memory limits in PM2 configuration
- Restart server periodically if needed
Database Issues
Database Lock Issues
Symptoms: "Database is locked", "Deadlock found", "Lock wait timeout"
Solution: Optimize database queries and connections
- Check for long-running transactions
- Optimize database queries
- Increase lock timeout settings
- Use connection pooling
- Check for concurrent access issues
Connection Pool Exhaustion
Symptoms: "Too many connections", "Connection pool exhausted"
Solution: Configure connection pooling properly
- Increase max_connections in MySQL configuration
- Configure Sequelize connection pool settings
- Implement connection retry logic
- Monitor connection usage
- Close unused connections properly
Security Issues
SSL/HTTPS Issues
Symptoms: "Mixed content", "SSL certificate errors", "Not secure"
Solution: Configure SSL properly
- Obtain valid SSL certificate
- Configure web server (Nginx/Apache) for HTTPS
- Update ALLOWED_ORIGINS to use HTTPS
- Redirect HTTP to HTTPS
- Update client configuration for HTTPS
Authentication Bypass
Symptoms: Users accessing unauthorized resources, permission errors
Solution: Review and fix authentication logic
- Check JWT token validation
- Verify permission middleware
- Review user role assignments
- Test all protected routes
- Implement proper session management
Log Analysis
Server Logs
# View server logs
tail -f /path/to/assets-manager/server/logs/combined.log
# View error logs
tail -f /path/to/assets-manager/server/logs/error.log
# View PM2 logs
pm2 logs assettrack-server
# Filter specific errors
grep "ERROR" /path/to/assets-manager/server/logs/combined.log
Database Logs
# MySQL error log
sudo tail -f /var/log/mysql/error.log
# MySQL slow query log
sudo tail -f /var/log/mysql/slow.log
# Check MySQL status
sudo systemctl status mysql
System Logs
# System logs (Linux)
sudo journalctl -u assettrack -f
# Nginx logs
sudo tail -f /var/log/nginx/error.log
sudo tail -f /var/log/nginx/access.log
# Apache logs
sudo tail -f /var/log/apache2/error.log
sudo tail -f /var/log/apache2/access.log
Getting Help
Before Seeking Help
- Check this troubleshooting guide
- Review server and client logs
- Verify all configuration files
- Test in a clean environment
- Document the exact error messages
Information to Provide
- Operating system and version
- Node.js and npm versions
- MySQL version
- Exact error messages
- Steps to reproduce the issue
- Relevant log entries
Useful Commands
# System information
node --version
npm --version
mysql --version
uname -a
# Process information
ps aux | grep node
ps aux | grep mysql
# Network information
netstat -tulpn | grep :3000
lsof -i :3000
# Disk space
df -h
du -sh /path/to/assets-manager
# Memory usage
free -h
top