Find solutions to common development errors quickly
ps aux | grep node # Check if Node.js server is running netstat -tuln | grep LISTEN # Check listening ports
Verify you're connecting to the right port (usually 3000, 8080, etc.)
npm start # or yarn start, npm run dev, etc.
// Node.js
server.timeout = 120000; // 2 minutes
// Axios
axios.get(url, { timeout: 30000 })
Look for errors or crashes in your server logs
// Retry with exponential backoff
const retry = async (fn, retries = 3) => {
for (let i = 0; i < retries; i++) {
try {
return await fn();
} catch (err) {
if (i === retries - 1) throw err;
await new Promise(r => setTimeout(r, 1000 * Math.pow(2, i)));
}
}
};
// Fetch API
fetch(url, { signal: AbortSignal.timeout(10000) })
// Axios
axios.get(url, { timeout: 10000 })
ping google.com traceroute google.com # or tracert on Windows
nslookup yourdomain.com dig yourdomain.com
ping hostname telnet hostname port
Ensure firewall isn't blocking outbound connections
Linux:
sudo iptables -L sudo ufw status
Windows:
netsh advfirewall show allprofiles
macOS/Linux:
lsof -i :3000 # Replace 3000 with your port sudo lsof -i :3000 # If permission denied
Windows:
netstat -ano | findstr :3000 # Note the PID in the last column
macOS/Linux:
kill -9 PID # Replace PID with actual process ID # Or use killport (if installed) npx kill-port 3000
Windows:
taskkill /PID [PID] /F
# For React PORT=3001 npm start # For Node.js/Express const PORT = process.env.PORT || 3001; # For Vite npm run dev -- --port 3001
Ports below 1024 require root/admin privileges. Use 3000, 8080, etc.
// Instead of port 80, use 8080 const PORT = 8080;
Linux/macOS:
sudo npm start # Not recommended
Windows:
Run terminal as Administrator
sudo setcap 'cap_net_bind_service=+ep' $(which node)
npm install --legacy-peer-deps
npm install --force
npm cache clean --force rm -rf node_modules package-lock.json npm install
Adjust version ranges to resolve conflicts
"dependencies": {
"react": "^18.0.0", // Make sure compatible versions
"react-dom": "^18.0.0"
}
npm cache clean --force
rm -rf node_modules package-lock.json npm install
npm install --registry=https://registry.npmjs.org/
ls -la path/to/file # Unix dir path\to\file # Windows
On Unix systems, paths are case-sensitive
rm -rf node_modules npm install
npx create-react-app my-app # Instead of global install
mkdir ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile source ~/.profile
sudo npm install -g package-name
git pull origin main --allow-unrelated-histories
git status # See conflicted files # Edit files to resolve conflicts git add . git commit -m "Merge unrelated histories"
git pull origin main # Resolve any conflicts if needed git push origin main
git pull --rebase origin main git push origin main
git push --force origin main # Overwrites remote!
git status
Look for conflict markers in the file:
<<<<<<< HEAD Your changes ======= Their changes >>>>>>> branch-name
git add conflicted-file.js git commit -m "Resolve merge conflict"
git merge --abort
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub # Copy the output and add to GitHub Settings > SSH Keys
ssh -T [email protected]
git remote set-url origin https://github.com/username/repo.git
MySQL:
sudo systemctl status mysql # Linux brew services list # macOS mysql.server status # macOS alternative
PostgreSQL:
sudo systemctl status postgresql # Linux brew services list # macOS
MongoDB:
sudo systemctl status mongod # Linux brew services list # macOS
sudo systemctl start mysql # MySQL sudo systemctl start postgresql # PostgreSQL sudo systemctl start mongod # MongoDB
Default ports: MySQL (3306), PostgreSQL (5432), MongoDB (27017)
DB_HOST=localhost DB_USER=your_username DB_PASSWORD=your_password DB_NAME=your_database
MySQL:
mysql -u root -p ALTER USER 'username'@'localhost' IDENTIFIED BY 'newpassword'; FLUSH PRIVILEGES;
PostgreSQL:
psql -U postgres ALTER USER username WITH PASSWORD 'newpassword';
-- MySQL GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost'; -- PostgreSQL GRANT ALL PRIVILEGES ON DATABASE database_name TO username;
// Node.js with MySQL
connection.end();
// Using pool
pool.query(sql, (err, result) => {
// Don't forget to release
connection.release();
});
const pool = mysql.createPool({
host: 'localhost',
user: 'user',
password: 'password',
database: 'db',
connectionLimit: 10
});
-- MySQL SET GLOBAL max_connections = 200; -- PostgreSQL (in postgresql.conf) max_connections = 200
npm install module-name # or yarn add module-name
// Correct relative paths import Component from './Component'; // Same directory import Component from '../Component'; // Parent directory // Node modules import express from 'express';
rm -rf node_modules package-lock.json npm install
// Use .jsx or .tsx extension for files with JSX // Or configure babel to handle .js files with JSX
// Wrong import App from './App.html'; // Correct import App from './App.js';
If importing a file that doesn't exist, you might get HTML error page
NODE_OPTIONS="--max-old-space-size=4096" npm run build
# Or in package.json
"scripts": {
"build": "NODE_OPTIONS=--max-old-space-size=4096 react-scripts build"
}
npm cache clean --force rm -rf node_modules .next build npm install npm run build
const cors = require('cors');
// Allow all origins (development only)
app.use(cors());
// Or specific origin (production)
app.use(cors({
origin: 'http://localhost:3000',
credentials: true
}));
@Configuration
public class WebConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000")
.allowedMethods("GET", "POST", "PUT", "DELETE");
}
};
}
}
// package.json
{
"proxy": "http://localhost:8080"
}
// Then use relative URLs
fetch('/api/data')
// vite.config.js
export default {
server: {
proxy: {
'/api': 'http://localhost:8080'
}
}
}
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
if (req.method === 'OPTIONS') {
return res.sendStatus(200);
}
next();
});
# Install django-cors-headers
pip install django-cors-headers
# settings.py
INSTALLED_APPS = [
'corsheaders',
...
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
...
]
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
]
😕 No errors found matching your search.
Try different keywords or view all errors
Can't find what you're looking for? Visit our Troubleshooting Center