我如何 运行 Deno 背后的企业代理

How can I run Deno behind corporate proxy

我正在尝试 运行 deno 在我公司的机器上。所以我支持公司代理。

当我尝试 运行 像这样的命令时:

deno run https://deno.land/std/http/server.ts

我收到一条错误消息:

Download https://deno.land/std/http/server.ts
error: error sending request for url (https://deno.land/std/http/server.ts): error trying to connect: tcp connect error: No connection could be made because the target machine actively refused it. (os error 10061)

我检查了 this GitHub Issue 但它仍然是打开的并且没有解决方案。

我也检查了 this GitHub Issue 但没有任何运气。

有一个 link 指向 this GitHub Issue 中的某个手册,但它已损坏。

啊!所以我得到了 link 到 manual for proxies here。如此处所述:

Deno supports proxies for module downloads and the Web standard fetch API.

Proxy configuration is read from environmental variables: HTTP_PROXY and HTTPS_PROXY.

In case of Windows, if environment variables are not found Deno falls back to reading proxies from registry.

所以我只是将 HTTP_PROXYHTTPS_PROXY 环境变量设置为代理 url(格式为 - http://my-proxy-domain.com:PORT/),它开始工作了。

希望这对其他人有帮助。