Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
The npm ping command does not work like expected. If there is a internet connection, I get a pong in <1 second like expected.
If I disconnect myself from the internet, I still get a pong always after around 70 seconds +/- 100ms. This is not the documented and expected behaviour.
This worked in npm v 6~. We have this command in a build script to check the connection to the npm registry. Sadly, we do not have an automated test for offline situation, so it took us very long to discover this.
Expected Behavior
I expect the npm ping command to fail if there is no internet connection.
Steps To Reproduce
- In this environment: Latest LTS node/npm version on Windows Server 2019 without a internet connection
- With this config: default config
- Run 'npm ping'
- See error: Pong after 70 s +/- 100ms
Here a screenshot from my System:
First ping was without internet connection, second one with.
Environment
- npm: 8.1.4
- Node: v16.13.1
- OS: Windows Server 2019 1809 Build 17763.107
- platform: VMWare Player running on
- npm config:
$ npm config ls
; "builtin" config from C:\Program Files (x86)\nodejs\node_modules\npm\npmrc
prefix = "C:\Users\Operator\AppData\Roaming\npm"
; "global" config from C:\Users\Operator\AppData\Roaming\npm\etc\npmrc
; strict-ssl = false ; overridden by user
; update-notifier = false ; overridden by user
; "user" config from C:\Users\Operator.npmrc
//pkgs.dev.azure.com/xxx/_packaging/xxx-external/npm/registry/:_password = (protected)
//pkgs.dev.azure.com/xxx/_packaging/xxx-external/npm/registry/:email = "not-used@example.com"
//pkgs.dev.azure.com/xxx/_packaging/xxx-external/npm/registry/:username = "VssSessionToken"
//pkgs.dev.azure.com/xxx/_packaging/xxx-internal/npm/registry/:_password = (protected)
//pkgs.dev.azure.com/xxx/_packaging/xxx-internal/npm/registry/:email = "not-used@example.com"
//pkgs.dev.azure.com/xxx/_packaging/xxx-internal/npm/registry/:username = "VssSessionToken"
registry = "https://registry.npmjs.org/"
strict-ssl = false
update-notifier = false
; node bin location = C:\Program Files (x86)\nodejs\node.exe
; cwd = C:\Program Files\Git
; HOME = C:\Users\Operator
; Run npm config ls -l
to show all defaults.
; copy and paste output from `npm config ls` here