Dart pub does not work behind a proxy server - is there a way to install packages manually?

Known issue with using Pub dart on a corporate network using proxies (at least on a Windows machine). You can't even run samples because they use the pub to receive packages. if you start samples first from the network without a proxy server, it works fine (the packages were installed) when you run them because of the proxy server.

My question is: how can I install packages manually?

Of course, I can get them from git, but what do I need to do after that to β€œinstall them”. I am confused by what is going on in the Dart installation directory, in the user directory, and the symbolic links that seem to be necessary. Maybe I missed something, but I did not find a good document about this.

thanks,

e.

+4
source share
2 answers

You can download package files manually, copy them to the packages folder, and then symbolically link to it from other places that use them (in Windows Vista and later versions you can use the mklink ). You can also just copy them everywhere, instead of a symbolic link, but this complicates the maintenance.

A simplified solution, if you have access to a full installation from a computer without a proxy, is to copy the package folder.

Even easier, I sometimes keep test projects in my Dropbox folder, so I just update when I'm on my home computer and it works fine on my office machine behind a proxy server.

At the same time, I managed to fix the problem with the proxy server by specifying the following system environment variables (the combination of addresses / ports is given below, use the correct one for your configuration):

 HTTP_PROXY: 192.168.123.123:1234 HTTPS_PROXY: 192.168.123.123:1234 

In addition, to allow DartEditor to check for editor updates, add the following to your DartEditor.ini file:

 -Dhttp.proxyHost=192.168.123.123 -Dhttp.proxyPort=1234 

If your proxy uses authentication, also check the following settings (mine is wrong I can not say):

 -Dhttp.proxyUser=XXX -Dhttp.proxyPassword=XXX 
+3
source

Another way is to use command line tools to get packages:

(On Windows)

  • Proxy settings

    • In cmd (not constant):

       SET HTTP_PROXY=proxy:port SET HTTPS_PROXY=proxy:port 
    • Or, as Zdeslav Vojkovic suggested, indicate system variables (constants).

  • Go to the sample application folder

     cd <path-to-dart-installation>\samples\angular_todo\ 
  • Run the required pub command:

     <path-to-dart-installation>\dart-sdk\bin\pub.bat get 

The project is automatically updated in the dart editor.


Edit: Try also setting proxy information as system environment variables, but using lower case, for example.

 http_proxy=proxy:port https_proxy=proxy:port 

As far as I know, Windows environment variables are not case sensitive. However, the dart editor seems to matter.

+1
source

Source: https://habr.com/ru/post/1483304/


All Articles