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
when running npm --help the command will hang. ( I waited over 5 minutes ).
After running strace I discovered that it was attempting to connect to https://registry.npmjs.org/npm. I then attempted to change the registry via npm config set but it also hangs. To resolve my issue I will configure an .npmrc.
Expected Behavior:
at least npm --help and npm config should work without connecting to the internet so a user who might have special firewall restrictions can play around with the cli help and change config settings. Commands can hang for numerous reasons. docker resources, system resources... etc. The last thing I would expect is that its hanging on the registry.
Steps To Reproduce:
Note while troubleshooting this I discovered that if there is a dns failure to the registry npm works as expected. If the registry dns resolves properly but the outbound port is blocked then the bug will appear.
# works ok
echo "registry=https://nodeclishouldnothangforever" >> ~/.npmrc
# should trigger the hanging behavior if dns resolves registry.npmjs.org but fails to connect. Perhaps sockets stuck in SYN_SENT
echo "registry=https://registry.npmjs.org/npm" >> ~/.npmrc
npm config set registry=https://myregistry.org --verbose
npm verb cli [
npm verb cli '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'config',
npm verb cli 'set',
npm verb cli 'registry=https://myregistry.org',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@7.5.3
npm info using node@v15.10.0
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 0ms
npm timing config:load:builtin Completed in 0ms
npm timing config:load:cli Completed in 3ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:/.npmrc Completed in 0ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:/root/.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:cafile Completed in 0ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:setUserAgent Completed in 0ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 10ms
npm verb npm-session 60520da2c3d791db
npm timing npm:load Completed in 25ms
[..................] \ : timing npm:load Completed in 25ms
# hanging here ^^^^^^
someoneout
changed the title
all npm commands hang indefinitely where outbound traffic to default registry is blocked
all npm commands hang where outbound traffic to default registry is blocked
Feb 25, 2021
fwiw the registry should be just https://registry.npmjs.org without the path.
if you update to the latest npm (7.9.0 as of now) do you still see this issue? i'm not able to reproduce this, whether blocking traffic to the registry or setting the registry to a host that resolves but doesn't respond.
The update notifier was running on (almost) all commands, and causing this behavior. That check has been made to be unblocking and this issue should be fixed.
Current Behavior:
when running npm --help the command will hang. ( I waited over 5 minutes ).
After running strace I discovered that it was attempting to connect to https://registry.npmjs.org/npm. I then attempted to change the registry via npm config set but it also hangs. To resolve my issue I will configure an .npmrc.
Expected Behavior:
at least npm --help and npm config should work without connecting to the internet so a user who might have special firewall restrictions can play around with the cli help and change config settings. Commands can hang for numerous reasons. docker resources, system resources... etc. The last thing I would expect is that its hanging on the registry.
Steps To Reproduce:
Note while troubleshooting this I discovered that if there is a dns failure to the registry npm works as expected. If the registry dns resolves properly but the outbound port is blocked then the bug will appear.
npm --help from a machine with internet access.
Environment:
The text was updated successfully, but these errors were encountered: