Troubleshooting
Common Issues and Solutions
1. OpenSSL Error on npm start
Error: Error: error:0308010C:digital envelope routines::unsupported
Solution: The project already includes the fix in package.json:
NODE_OPTIONS='--openssl-legacy-provider' ng serve
2. Module Not Found Errors
Solution: Clear cache and reinstall:
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
3. Port Already in Use
Error: Port 4200 is already in use
Solution: Kill the process or use a different port:
# Kill process on port 4200 (Unix/Mac)
lsof -ti:4200 | xargs kill -9
# Or use different port
ng serve --port 4300
4. CORS Errors
Issue: API requests blocked by CORS policy
Solution:
- Configure backend to allow frontend origin
- Use proxy configuration during development:
Create proxy.conf.json:
{
"/api": {
"target": "https://api.onmarket.id",
"secure": true,
"changeOrigin": true
}
}
Update angular.json:
"serve": {
"options": {
"proxyConfig": "proxy.conf.json"
}
}
5. JWT Token Expired
Issue: Session expired errors
Solution:
- Token verification happens on each protected route
- User is automatically redirected to login
- No manual intervention needed
6. WebSocket Connection Issues
Issue: Socket.io connection fails
Solution:
- Check if WebSocket server is running
- Verify JWT token is valid
- Check network connectivity
- Verify API_ONMARKET_SERVER URL
7. Angular Material Theme Not Applied
Solution: Ensure custom-theme.scss is imported in angular.json:
"styles": [
"src/custom-theme.scss",
"src/styles.scss"
]
8. Build Memory Issues
Error: JavaScript heap out of memory
Solution: Increase Node.js memory limit:
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build