npm Community Forum (Archive)

The npm community forum has been discontinued.

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

maxsockets flag ignored, cntlm proxy hangs because of too many requests

What I Wanted to Do

Run npm install using a pre-written package.json file, inside a docker container, behind a cntlm corporate
proxy. Since cntlm hangs if there are too many requests being fired off (Error: too many files open), I set the maxsockets to 5 using npm set maxsockets 5.

What Happened Instead

The hundreds of requests were still fired, the maxsockets configuration was ignored, even though it appears
when I run
npm config list

Reproduction Steps

This gist includes all dependencies of my project. it is a mirror of the package.json I am using.

Set up cntlm in gateway mode. Listen to the docker0 interface.
Traffic from within the container will be routed to the cntlm proxy handler (localhost:3128 by default)

Dockerfile for the image

Try to build the image. As soon as I reach the npm install command, it immediately fires off a lot of requests,
and within half a minute cntlm hangs. After a while (~15 minutes) this is what the shell outputs


I tried to do as much research as possible as I am trying to setup a CI/CD pipeline here.
It supposedly was an old issue :
That seems to have been fixed, but alas in my case, the maxsockets setting is still being ignored.

Hosting a mirror npm registry is out of the question currently. Getting rid of cntlm is also out of the question.

Platform Info

npm/6.4.1 node/v10.13.0 linux x64

More info here:

npm is a major version behind pacote, which will use the new version of agent-base. However, those major changes will have to be reflected in the npm codebase first.