-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands that involve npm are taking too long when behind proxy #3683
Comments
npm 6.2 seems to include an option to disabled the update check via |
Hey @n0v1 ,
For example:
|
Yes, I've set the npm proxy settings from day one. npm works fine when using it "normally". Disabling the update check by setting the environment variable NO_UPDATE_NOTIFIER fixes the problem for me. It persists otherwise. |
Okay, thanks for the information. As the issue is related to npm itself not NativeScript specifically, I'm closing it. |
Please, provide the details below:
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
yes
Tell us about the problem
When you are behind a corporate proxy and you execute NativeScript CLI commands like
tns doctor
that in turn executes npm commands likenpm -v
in a child process, those commands take far too long to finish.tns doctor
for example runs for 3 minutes until the results are shown.This seems to happen on Windows systems only.
Debugging showed that the cause of this problem is the update check feature that was introduced in npm 4.4.0. The update-notifier package that is used for this does not support proxies. It spawns a deferred child process that prevents the parent process (the one that executes
npm -v
) from closing on some platforms.See this call in nativescript-doctor sys-info: https://github.com/NativeScript/nativescript-doctor/blob/81fe42a2cd63812b138bcd579ecbb384d83bcf0d/lib/sys-info.ts#L99
The callback here will be called only after the process closes. On windows the close event of this child process will be fired after the update check process is completed. As it does not support proxies, it times out after 3 minutes with a unhandled promise rejection (that does not hit the surface) and so the script execution halts here for this 3 minutes.
This problem occurs with all npm version from 4.4.0 up.
A workaround could be to set the environment variable
NO_UPDATE_NOTIFIER
for the CLI process (and thus for all child processes it spawns). See package description.Please provide the following version numbers that your issue occurs with:
4.1.0
3.4.1
tns-android@4.1.2
nativescript-barcodescanner
,nativescript-webview-interface
,nativescript-vue
Please tell us how to recreate the issue in as much detail as possible.
Please see this repository
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
Expected output:
Actual output without an expicit timeout:
Actual output with an timeout of 10 seconds:
Actual output equals expected output when adding environment variable
NO_UPDATE_NOTIFIER
to the exec options.Related issues
npm --version
takes 3 minutes to complete when run in child process and behind corporate proxy npm/npm#20979The text was updated successfully, but these errors were encountered: