Troubleshooting
Encountering issues during setup or usage? Below are common errors and their solutions.
1. MongoDB Connection Error
Symptom: Backend server crashes on startup with MongoTimeoutError or MongoNetworkError.
Solution:
- Ensure your MongoDB server is running (if installed locally).
- If using MongoDB Atlas, check that your IP address is whitelisted in the Network Access tab.
- Verify that your
MONGODB_URIstring in the.envfile is correct and properly formatted without missing characters.
2. npm/yarn Install Error
Symptom: Running npm install or yarn fails with generic ERR! messages.
Solution:
- Delete
node_modulesfolder andpackage-lock.jsonoryarn.lock, then runnpm cache clean --forceand try again. - Verify your Node.js version. Some dependencies require a specific version. We recommend
v16.xorv18.x. - Ensure you have a stable internet connection.
3. Build Error
Symptom: yarn build or npm run build fails on the frontend.
Solution:
- Check the console output for syntax errors in the code.
- Ensure all environment variables used in the frontend (e.g.,
REACT_APP_...) are correctly defined in your.envbefore building. - Check if your server has enough RAM. Insufficient memory (e.g., a 512MB VPS) can cause build processes to terminate unexpectedly.
4. API Error (CORS or 404)
Symptom: The frontend cannot communicate with the backend, displaying CORS errors in the browser console. Solution:
- Ensure the backend server is running.
- Verify that the frontend
.envpoints exactly to the backend URL (e.g.,http://localhost:5000orhttps://api.yourdomain.com). - On the backend, ensure the CORS middleware is configured to accept requests from your frontend domain.
5. Authentication Error
Symptom: Unable to login, getting "Invalid Credentials" or "Token Expired". Solution:
- Ensure you registered the user successfully.
- Check if the
JWT_SECRETin the backend.envis set correctly. If the secret changes, all existing tokens become invalid. - Clear your browser cookies and local storage, and try logging in again.
6. Payment Error
Symptom: Payment gateway integration fails during transactions. Solution:
- Verify that you are using the correct API keys (Publishable vs. Secret keys).
- Ensure your payment gateway account is active and not restricted.
- If testing, make sure you are using Sandbox/Test keys and not Live keys.
7. Email Error
Symptom: Registration emails, password resets, or inquiry emails are not being sent. Solution:
- Verify the SMTP/Email service API credentials in your
.env. - Some cloud providers (like DigitalOcean or AWS) block SMTP port 25 or 465 by default to prevent spam. Check your firewall settings.
- Check the logs of your email provider (e.g., SendGrid) to see if emails are bouncing.
8. Environment Variable Error
Symptom: Application behaves unpredictably or certain features don't load. Solution:
- Ensure you have renamed
.env.exampleto.env. - Restart your server! Node.js and React/Next.js processes must be restarted for any
.envchanges to take effect.