raineorshine/npm-check-updates

NCU does not appear to respect NPMs proxy settings

Opened this issue · 8 comments

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates
  • I am using node >= 12

Steps to Reproduce

Set up a proxy, and configure NPM to use it.

Current Behavior

The network traffic NCU uses to verify the status of packages does not go through the proxy (and fails completely when using said proxy is necessary to get to the internet)

Expected Behavior

NCU should respect NPMs proxy configuration, and successfully make calls via the prroxy.

Thanks for reporting. Can you clarify exactly which npm config variables are set for your proxy configuration? That will help ensure I am testing the same setup.

Also, once I do set up a proxy on my machine to test, any tips on how to tell whether it is being used or not? I don't have experience in this area.

The command I used (with redactions) to enable the proxy is as follows;

npm config --global set proxy http://PROXY_URL:PROXYPORT

The easiest way to see if the proxy is being used is probably going to be by that p;roxy's logs I think. You should be able to turn on verbose logging. Once you have, you should see every expected URL come up in the logs. Any missing ones presumably aren't going through the proxy.

A proxy that definitely supports these kinds of logs on windows is privoxy, if that helps.

I tried to sign up for a free trial of a proxy server, but it didn't work for me. I'm sure there is something out there that will work, but it's not something I can put more time into right now. If you can provide me with a proxy server for testing purposes I'm willing to take another stab at it. Otherwise you might be the best person to troubleshoot and submit a PR.

I mentioned Privoxy in the previous message - did that not work for you?

I thought it was Windows-only based on your comment, but I see that it is also for MacOS. I'll give it a try and see how far I get.

I was able to install Privoxy on OSX, but it's not exactly user friendly. https://www.privoxy.org/config/ says it's not enabled, and p.p says it is. I'm not sure which is correct. It does not log requests by default, and the config file is not where the documentation says it should be, so I'm not able to enable verbose logging.

If this was my day job, I might be more motivated to pursue this further. However, at this time I'm going to direct my attention elsewhere, though I am sympathetic to finding a fix. Please feel free to investigate on your own time, and I will be more than happy to provide direction for a PR.

Totally fair.

Ok, I had a poke around. The issue might be in pacote. I can see here that npmConfig is passed through, and I've verified that the proxy settings are present in the npmConfig object.

I might have to take this deeper :(