This guide provides solutions for common issues encountered during the environment setup and development of GrindMap.
- MongoDB Connection Failures
- Node.js Version Mismatches
- API Timeout Errors
- Port Already in Use
- Environment Variable Issues
The backend requires MongoDB to be running, typically on the default port 27017.
- Backend crashes immediately on
npm start. - Error messages like
MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017.
- Check Service Status: Ensure the MongoDB service is active on your machine.
- Windows: Open Task Manager, look for
mongod.exe, or runnet start MongoDBin an Administrator terminal. - Linux: Run
sudo systemctl start mongod. - macOS: Run
brew services start mongodb-community.
- Windows: Open Task Manager, look for
- Verify Connection String: Ensure your
.envfile in the backend directory has the correctMONGODB_URI(e.g.,mongodb://localhost:27017/grindmap). - Docker Users: If using Docker, ensure the mongodb container is healthy by running
docker-compose ps.
GrindMap requires Node.js v14 or higher.
npm installfails with engine mismatch errors.- Syntax errors (e.g., optional chaining
?.not recognized) in older Node versions.
- Check Version: Run
node -vto verify your current version. - Use NVM (Recommended): Use Node Version Manager to switch to a compatible version:
nvm install 16 nvm use 16
- Docker: Docker setup bypasses this issue by using a consistent Node environment within the container.
Timeouts often occur during data scraping or when the database is slow to respond.
- Frontend shows "Loading..." indefinitely or returns a
504 Gateway Timeout. - Backend logs show
Puppeteer TimeoutorNavigation Timeout.
- Increase Scraper Timeout: In the relevant scraper file (e.g.,
backend/src/services/scraping/), increase the timeout values for Puppeteer'swaitUntilorwaitForSelector. - Database Performance: If queries are slow, ensure you have indexed frequently used fields like
userId. - Network Stability: Some platforms (like CodeChef or AtCoder) may require more time to render JavaScript; ensure your internet connection is stable.
The application defaults to ports 3000 (Frontend) and 5000 (Backend).
- Error:
EADDRINUSE: address already in use :::5000.
- Kill Existing Process:
- Windows: Run
netstat -ano | findstr :5000, thentaskkill /PID <PID> /F. - Linux/Mac: Run
lsof -i :5000thenkill -9 <PID>.
- Windows: Run
- Change Default Ports: Modify the
PORTvariable in your.envfiles to an available port (e.g.,5001).
Missing configuration often leads to authentication or connection failures.
JWT_SECRETerrors or undefined database URI logs.
- Initialize .env: Copy the provided template to create your local environment file:
cd backend cp .env.example .env - Restart Server: Always restart the backend server after making changes to the
.envfile to apply the new configuration.
Check the Contributor Debugging Guide for deeper technical insights or open a new issue with your error logs.