npm-check
npm-check copied to clipboard
support for proxy config
16:23 $ npm-check
autosuggest-highlight ⛔️ NPM ERR! Registry error getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
...
both env http_proxy
, https_proxy
(lower and uppercasE) and npm proxy
and https_proxy
are setup.
I guess this is because of @sindresorhus 's package-json
- see https://github.com/sindresorhus/package-json/blob/master/index.js#L13
Thanks for reporting this issue and researching the cause. Do you want to create an issue for https://github.com/sindresorhus/package-json?
See: https://github.com/sindresorhus/package-json/issues/22
I'm also behind a proxy having a similar issue but I thought I'd add that I have not set up proxy configs in npm because I use the netsh winhttp
command (I'm on windows, obviously) to set my proxy and this is normally sufficient for npm to make any connections it needs (env variables are also set similar to what @DimitarChristoff explained). Maybe it makes no difference at all but, ideally, this should work no matter which way the proxy is configured.
shouldn't this be using npm outdated
internally, rather than a third
party module
On Friday, 8 April 2016, Elijah Madden [email protected] wrote:
I'm also behind a proxy having a similar issue but I thought I'd add that I have not set up proxy configs in npm because I use the netsh winhttp command (I'm on windows, obviously) to set my proxy and this is normally sufficient for npm to make any connections it needs (env variables are also set similar to what @DimitarChristoff https://github.com/DimitarChristoff explained). Maybe it makes no difference at all but, ideally, this should work no matter which way the proxy is configured.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/dylang/npm-check/issues/106#issuecomment-207167463
Dimitar Christoff
"JavaScript is to JAVA what hamster is to ham" @D_mitar - https://github.com/DimitarChristoff
shouldn't this be using
npm outdated
internally,
@DimitarChristoff Interesting idea!
I used to avoid spawning multiple copies of npm because of issues older npm had running more than one copy at once, but those issues are resolved in npm@2
and newer. We'll need that to do npm info <package>
for each outdated package to get some additional metadata for the UI.
Seems worth trying. Do you want to make a PR for this?
Just to clarify, I'm also behind a proxy and have the issue. I have however configured npm to go through the proxy and using only npm works nicely.
>npm config list
; cli configs
[...]
; userconfig ...\.npmrc
init-author-email = "[email protected]"
init-author-name = "me noyb"
save-exact = true
; builtin config undefined
https-proxy = "https://proxyUrl:proxyPort/"
[...]
proxy = "http://proxyUrl:proxyPort/"
registry = "http://registry.npmjs.org/"
So if you are using npm behind the scene, it should take into account the environment and the .npmrc configuration into account...
This line https://github.com/sindresorhus/package-json/blob/master/index.js#L11 should have loaded the npmrc configuration unless I'm mistaken... but is the proxy variable than used.
This should solve the issue: https://www.npmjs.com/package/got#proxies
If I have time I'll do a pull request after testing the change !
Also behind a proxy and use npm-check
frequently. My temporary workaround is to manually edit npm-check/node_modules/package-json/index.js
:
var caw = require('caw');
return got(pkgUrl, {
json: true,
headers: headers,
agent: caw()
})
Add manually header basic authorization:
$ printf "login:password" | base64
In file index.js of npm-check package-json:
..\npm\node_modules\npm-check\node_modules\package-json\index.js
add this (after authInfo) :
headers.authorization = 'Basic dGthbXYXYXXYXYXYXYXyMDcwIQ==';
caw
or tunnel
doesn't work on my paranoiac network.
Thanks @robmcguinness for the fix with caw. I have forked the original package-json, and made the changes you suggested in the fork. Anyone requiring an easier fix, see the "Usage" section in the readme
It appears that the issue won't be fixed in the upstream package of sindresorhus/package-json#22 as its author do not want to deal with proxy configuration.
Either someone succeed in making him change his mind, or npm-check
should switch from package-json
to another dependency (it could be the fork of package-json that support proxies: thtliife/package-json), or npm-check
won't ever be usable for all organizations that require a proxy configuration to go on the internet.
@dylang Any opinion on this?
I edited the files to use caw, but now i get Registry error Redirected 10 times. Aborting.
does someone knows how to fix that?