7

在公司网络中使用代理(至少在 Windows 机器上)使用 Pub dart 存在一个已知问题。您甚至无法运行示例,因为它们使用 pub 来获取包。如果您首先从没有代理的网络运行示例,那么当您从代理后面运行它们时,它工作得非常好(软件包已安装)。

我的问题是:如何手动安装软件包?

例如,我当然可以从 git 中获取它们,但是之后我必须做什么才能“安装它们”我对 Dart 安装目录、用户目录和似乎必要的符号链接中的内容感到困惑。可能是我错过了一些东西,但我没有找到任何好的文档。

谢谢,

F。

4

2 回答 2

5

您可以手动下载软件包文件,将它们复制到packages文件夹,然后从其他使用它们的地方符号链接到它(在 Windows Vista 和更高版本上,您可以使用mklink命令)。您也可以将它们复制到任何地方,而不是符号链接,但这会使维护复杂化。

更简单的解决方案是,如果您可以从没有代理的机器上进行完整安装,则从那里复制包文件夹。

更简单的是,我有时会将测试项目保存在我的保管箱文件夹中,所以我只是在我的家用计算机上更新,它在代理后面的办公室机器上运行良好。

话虽这么说,我可以通过指定以下系统环境变量来解决代理问题(下面的地址/端口组合已组成,为您的设置使用正确的组合):

HTTP_PROXY:  192.168.123.123:1234  
HTTPS_PROXY: 192.168.123.123:1234  

此外,要使 DartEditor 能够检查编辑器更新,请将以下内容添加到您的 DartEditor.ini 文件中:

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

如果您的代理使用身份验证,那么还要检查以下设置(我的没有,所以我不知道):

-Dhttp.proxyUser=XXX
-Dhttp.proxyPassword=XXX
于 2013-05-29T08:47:24.040 回答
2

Another way to go is using the command line tools for getting the packages:

(On Windows)

  1. Proxy Settings

    • In the cmd (not persistent):

      SET HTTP_PROXY=proxy:port
      SET HTTPS_PROXY=proxy:port
      
    • Or as Zdeslav Vojkovic suggested - specify system environment variables (persistent).

  2. Go to the sample app folder

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

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

Project is automatically updated in the dart editor.


Edit: Try as well setting the proxy information as system environment variables, but using lower case e.g.

http_proxy=proxy:port
https_proxy=proxy:port

As far I as know Windows environment variables are not case sensitive. However dart editor seems to make difference.

于 2014-02-18T10:21:18.617 回答