Software⏱️ 2 min read📅 2026-05-30

How to Fix: DNS Resolution Issue: `nslookup` Works But `curl` Fails

Learn how to fix: DNS Resolution Issue: `nslookup` Works But `curl` Fails.

Quick Answer: Try checking your system settings or restarting.

DNS resolution issues in Node.js applications can be frustrating, especially when nslookup works but curl fails. In this article, we'll explore the possible causes and solutions to resolve this issue.

💡 Why You Are Getting This Error

  • [Cause]

✅ Best Solutions to Fix It

Method 1: DNS Cache

  1. Step 1: Flush the DNS cache on your system using sudo /etc/init.d/dnsmasq flushcache (on Ubuntu-based systems) or ipconfig /flushdns (on Windows).

Method 2: Verify DNS Configuration

  1. Step 1: Check your DNS configuration by running nslookup -type=soa registry.npmjs.org. If the output contains an SOA (Start of Authority) record, it indicates that the DNS is configured correctly.

🎯 Final Words

By following these methods, you should be able to resolve the DNS resolution issue and successfully use curl in your Node.js application.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions