Common Issues
Quick fixes for frequently encountered problems.
Build Errors
Module not found
Module not found: Can't resolve '@/components/...'Fix: Check the import path. Ensure the file exists and the path alias is correct.
# Verify the file exists
ls components/ui/button.tsx
# If using new files, restart the dev server
npm run devType errors after schema changes
Type 'X' is not assignable to type 'Y'Fix: Regenerate Prisma Client after schema changes.
npx prisma generatehydration mismatch
Hydration failed because the initial UI does not match...Fix: This usually happens when client-rendered content differs from server-rendered. Common causes:
- Using
Date.now()orMath.random()in initial render - Browser extensions modifying the DOM
- Using browser-only APIs without checks
// Bad
<p>{new Date().toISOString()}</p>
// Good - use client component
"use client"
import { useEffect, useState } from 'react'
function CurrentTime() {
const [time, setTime] = useState('')
useEffect(() => {
setTime(new Date().toISOString())
}, [])
return <p>{time}</p>
}Development Server
Port already in use
Error: listen EADDRINUSE: address already in use :::3000Fix: Kill the process using the port or use a different port.
# Find the process
lsof -i :3000
# Kill it
kill -9 <PID>
# Or use a different port
npm run dev -- -p 3001Hot reload not working
Fix:
- Clear
.nextfolder - Restart dev server
rm -rf .next
npm run devEnvironment Variables
Variables not loading
Error: Missing required environment variable: DATABASE_URLFix:
- Ensure
.env.localexists in the project root - Variables must be prefixed with
NEXT_PUBLIC_for client-side access - Restart the dev server after adding variables
# Check if file exists
cat .env.local
# Restart
npm run devVariables undefined in client components
Fix: Only NEXT_PUBLIC_* variables are available client-side.
// Server-side only
const secret = process.env.PAYSTACK_SECRET_KEY
// Available client-side
const publicKey = process.env.NEXT_PUBLIC_PAYSTACK_PUBLIC_KEYPrisma Issues
Cannot find module ‘.prisma/client’
Fix: Generate the Prisma Client.
npx prisma generateMigration failed
Error: P3009: migrate found failed migrationsFix:
# Mark the migration as resolved
npx prisma migrate resolve --applied <migration_name>
# Or reset (development only - loses all data)
npx prisma migrate resetConnection timeout
Error: Connection terminated unexpectedlyFix:
- Check
DATABASE_URLis correct - Ensure using port 6543 for pooled connection
- Verify Supabase project is not paused
Authentication
Session not persisting
Fix:
- Check
NEXTAUTH_SECRETis set - Verify
NEXTAUTH_URLmatches your domain - Clear cookies and try again
OAuth redirect error
Fix:
- Add your domain to allowed redirect URLs in Google Console
- Ensure callback URL matches exactly:
- Dev:
http://localhost:3000/api/auth/callback/google - Prod:
https://y3nko.travel/api/auth/callback/google
- Dev:
TypeScript
Cannot find name ‘React’
Fix: Add React import or configure tsconfig.
// Option 1: Import React
import React from 'react'
// Option 2: tsconfig.json (already configured)
{
"compilerOptions": {
"jsx": "preserve"
}
}‘any’ type warnings
Fix: Add proper types.
// Bad
function processData(data: any) {}
// Good
interface DataType {
id: string
name: string
}
function processData(data: DataType) {}Next.js
Page not found (404) for existing page
Fix:
- Ensure file is named
page.tsx(notPage.tsxorindex.tsx) - Check folder structure matches expected URL
- Restart dev server
Images not loading
Fix: Add domain to next.config.js:
// next.config.js
module.exports = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'res.cloudinary.com',
},
],
},
}Still Stuck?
- Check the console for detailed error messages
- Search existing GitHub issues
- Ask in the team chat with:
- Error message
- Steps to reproduce
- What you’ve tried