Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm --version takes 3 minutes to complete when run in child process and behind corporate proxy #20979

Open
4 of 14 tasks
n0v1 opened this issue Jun 13, 2018 · 0 comments
Open
4 of 14 tasks

Comments

@n0v1
Copy link

n0v1 commented Jun 13, 2018

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • npm is producing incorrect or undesirable behavior.
  • Other (see below for feature requests):

What's going wrong?

When we tried to build an Android application using the NativeScript CLI, it took ages. Debugging showed that the process hangs for 3 minutes when trying to get the currently installed npm version in this script.

To get the npm version, NativeScript executes the command npm -v in a child process and waits for the output.

The update check feature that was introduces with npm@4.4.0 does not support proxies and thus prevents the child process from closing until it times out after 3 minutes.

The update check feature uses the update-notifier package that uses the latest-version package which in turn uses package-json. package-json currently does not support proxies and the author seems not to be willing to implement proxy support.

How can the CLI team reproduce the problem?

This repository holds a script to reproduce the problem. The error occurs only when you are behind a corporate proxy and probably only on Windows systems (tested Windows 7 and Windows 10).

Workarounds

See https://github.com/yeoman/update-notifier#user-settings

  • Set environment variable NO_UPDATE_NOTIFIER=1
  • Use --no-update-notifier flag
  • Set "optOut": true in ~/.config/configstore/update-notifier-[your-module-name].json

Possible solutions

  • Skip update check if a proxy is used (check if proxy variables are set in npm config?)
  • Implement a (short) timeout for the proxy check and kill the child process after that (would have to be implemented in update-notifier package
  • Use another module for the update check that has proxy support
  • Use another method to get the latest npm version from the registry that relies on the npm proxy configuration (npm outdated, npm view)

Related issues

supporting information:

  • npm -v prints: 5.6.0
  • node -v prints: 8.11.1
  • npm config get registry prints: https://registry.npmjs.org/
  • Windows, OS X/macOS, or Linux?: Windows 7
  • Network issues:
    • Geographic location where npm was run: Germany
    • I use a proxy to connect to the npm registry.
    • I use a proxy to connect to the web.
    • I use a proxy when downloading Git repos.
    • I access the npm registry via a VPN
    • I don't use a proxy, but have limited or unreliable internet access.
  • Container:
    • I develop using Vagrant on Windows.
    • I develop using Vagrant on OS X or Linux.
    • I develop / deploy using Docker.
    • I deploy to a PaaS (Triton, Heroku).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant