npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

--no-proxy missing from npm cli

What I Wanted to Do

I’m trying to pass --no-proxy on the npm cli
such as

npm --proxy http://proxy.company.com --no-proxy .company.com install somePackage

What Happened Instead

having that --no-proxy makes npm barf
note that no-proxy is in https://docs.npmjs.com/misc/config
(not the same level of documentation as proxy, specially missing to state (or otherwise):
“no_proxy settings will be honored by the underlying request library”)

I suspect env[NO_PROXY] or putting on .npmrc might work…

Reproduction Steps

Just try
npm --proxy http://proxy.company.com --no-proxy .company.com install somePackage

Details

Platform Info

Mac OSx 10.13.5

try with npm 5.6.0 and 6.2.0 (which I think is the lastest)

here the full --versions
fheidric@fheidric-mac ui$ npm --versions
{ iotui: ‘1.0.0’,
npm: ‘6.2.0’,
ares: ‘1.14.0’,
cldr: ‘33.1’,
http_parser: ‘2.8.0’,
icu: ‘62.1’,
modules: ‘64’,
napi: ‘3’,
nghttp2: ‘1.32.0’,
node: ‘10.8.0’,
openssl: ‘1.1.0h’,
tz: ‘2018e’,
unicode: ‘11.0’,
uv: ‘1.22.0’,
v8: ‘6.7.288.49-node.19’,
zlib: ‘1.2.11’ }


I thought this was in place, or at least most of the groundwork was laid out. This might be an interesting patch for someone to put together.


update: I just realized this is because --no- get translated to the positive version. So the patch to lib/config/defaults.js we previously affected was wrong and should be noproxy instead. I believe that will fix the bug if anyone’s interested in filing it. :slight_smile:


I’d love to have a go at fixing this!
What’s the proper protocol for being assigned this bug and opening a PR? :blush:
Thanks!


“I wanna do this” -> go write a PR. It’s very unlikely for you to get preempted :slight_smile:


@jth Oh I’m so sorry, I didn’t realize you were going to take this issue before I opened the PR. That’s completely my bad :frowning:


No worries, friend! I got a bit tied up at work and wasn’t able to strike while the iron was hot, and that’s alright.
I’m certain there will be more bugs, and as long as the problem’s been resolved, we’re all better off for it.


damnit, y’all. It didn’t even take a day for me to be wrong?!


Finally got CI to work lol! Tyvm for the opportunity, I hope to help out more in the future :slight_smile:


The PR has been merged. This will be included in the next npm release. Thanks, @SneakyFish5

https://github.com/npm/cli/pull/46