DEV Community

kamilrashidev
kamilrashidev

Posted on

How I Fixed NPM Package Installation errors

Fix your DNS

When you have trouble installing packages, check logs and if it has issues with GET requests, then change your DNS. I changed mine from Cloudflare's 1.1.1.1, 1.0.0.1 to Google's 8.8.8.8, 8.8.4.4 and it worked. Cloudflare DNS is good but I don't know why it gave headache for me. Google worked better in my case. So, it is up to you to choose a DNS server that suits you best.

Use VPN

Sometimes because of issues with ISP, we may have to face errors. to avoid it use a good VPN. if you have servers/VPS, you may use services like Tailscale to set up your own free private VPN.

PNPM Installer

PNPM is an alternative to NPM. PNPM is faster than NPM. It gives better logs than NPM so you may identify the reason for installation errors with ease and fix it accordingly.

Installing NodeJS exe from nodeJS website

[!TIP] This step is important for Windows. Linux and Mac come with these software programs pre-installed.

While installing NodeJS, download from the official site's exe file and make sure everything is checked as in the images below. This will help prevent errors while installing plugins.

nodejs-installation-tutorial-1

nodejs-installation-tutorial-2

That's it fellow devs. If you have tips, please comment below. :)

Top comments (0)