Nativescript-cli: `tns create` command not using proxy set with `tns proxy set`

Created on 17 Aug 2018  路  7Comments  路  Source: NativeScript/nativescript-cli

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

Pacote fetch does not use the proxy that has been set via tns proxy set

Which platform(s) does your issue occur on?

Windows 10 Enterprise 2016 LTSB

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.2.1
  • Cross-platform modules: Not related to issue
  • Runtime(s): Not related to issue
  • Plugin(s): Not related to issue

Please tell us how to recreate the issue in as much detail as possible.

  1. Set a proxy via tns proxy set
  2. Create a console log or debug the script in "%USERPROFILE%\AppData\Roaming\npm\node_modules\nativescript\node_modules\pacote\lib\fetchers\registry\fetch.js" at line 13 to look into the "opts" variable. It does not contain the proxy options that have been set before.
  3. This results in a fetch that does not use the proxy thus leading to a timeout if you are behind a proxy.
  4. It can be fixed temporarily by setting "opts.noProxy = false" and "opts.proxy = PROXY_URL".

It would be nice if the cli could set these properties correct so the user doesn't have to manually code the PROXY_URL into the dependency.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

There is no own code involved.

bug

Most helpful comment

Hello @rosen-vladimirov that also did the trick! Thanks a lot for your help. Appreciate it.

All 7 comments

Hey @NicoEnking ,
Thanks for reporting this issue. I confirm it is an issue in the new implementation of the project creation that we are using in CLI 4.2.x
We'll include a fix in our code base for one of our next patch releases.

Thank you @rosen-vladimirov ! Glad to hear that this will be fixed soon.

Hey @NicoEnking ,
Can you try the latest rc version of NativeScript CLI and comment if it resolves your issue? You can install it by executing:

npm i -g nativescript@rc

Yes I will try it in ~ 2 hours. Going to report to you wether it works now or not.

@rosen-vladimirov seems to work like a charm. Just another question. NativeScript is quite slow here while it's pretty fast on my private pc. Is there any reason why this happens and how to fix it? Some commands need minutes to execute. I could hunt it down to all $childProcess.exec() calls, for example in node-package-manager.js in line 130. This could be a related issue: https://github.com/nodejs/node/issues/21632

Hey @NicoEnking ,
Can you try the suggestion in this comment: https://github.com/NativeScript/nativescript-cli/issues/3683#issuecomment-410378696
It looks like npm operations are slowed down by npm's internal logic for checking if there's a newer version.

Hello @rosen-vladimirov that also did the trick! Thanks a lot for your help. Appreciate it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickIliev picture NickIliev  路  3Comments

farfromrefug picture farfromrefug  路  3Comments

ZMW9 picture ZMW9  路  3Comments

NickIliev picture NickIliev  路  3Comments

Fatme picture Fatme  路  3Comments