You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
; 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
The text was updated successfully, but these errors were encountered:
kobL
changed the title
[BUG] npm ping does respond with pong even if there is no network connection
[BUG] npm ping does respond with pong even if there is no internet connection
Dec 2, 2021
notes for fixing:
the problem is that npm-registry-fetch sees the ?write=true flag and sets the cache mode to no-cache which sounds correct, but the semantics for that mode allow stale responses in the event that the revalidation request fails. we don't want to allow stale responses here, so what we actually need is a mode of no-store. we'll need to either add a --online flag to the cli that maps to no-store or we'll need to patch npm-registry-fetch to detect this case (probably using the ?write=true query param) and sets the mode there
Is there an existing issue for this?
This issue exists in the latest npm version
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
Here a screenshot from my System:
First ping was without internet connection, second one with.
Environment
$ 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
The text was updated successfully, but these errors were encountered: