Node NPM error: URIError: URI malformed at decodeURIComponent (native) at Url.parse


Problem: If you are using node and accidentally change your proxy settings every time  you run npm you get something like this:

NPM error: URIError: URI malformed at decodeURIComponent (native) at Url.parse

What Happened there?
Once a bad URL makes it in to the config file, it is broken, but you as the operator are unaware until you do another operation. This was confusing when I was setting both HTTP and HTTPS proxies. It delayed me from finding the real problem. To resolve this issue it would be great if the URLs were validated before they went in the file. This would reduce confusion.

How to solve this?

  1. You cannot reset npm config from command-line because the npm command doesn't work anymore
  2. Reinstalling node will not help
  3. Locate where npm has its global settings stored: C:\Users\Ady\.npmrc
  4. edit the file and everything is back to normal!

This solves a similar but different problem: 

Comments

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?