[backport-v8.x] backport npm/npm@4ca6958
Backporting https://github.com/npm/npm/commit/4ca6958196ae41cef179473e3f7dbed9df9a32f1 ( https://github.com/nodejs/node/commit/9f33a248b37ed5acb31cffe2483d5dfc3db89521 and https://github.com/nodejs/node/commit/b8888f5aa2deb41b7ab03d3085124eef398e461e) that wasn't backported in https://github.com/nodejs/node/pull/16509
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines