deno代码的网络问题大家有没有什么好方法解决

我挂上梯子

> deno run https://deno.land/std/examples/curl.ts https://example.com
Download https://deno.land/std/examples/curl.ts
error: error sending request for url (https://deno.land/std/examples/curl.ts): error trying to connect: invalid dnsname

不挂梯子

> deno run https://deno.land/std/examples/curl.ts https://example.com
Download https://deno.land/std/examples/curl.ts
error: Import 'https://deno.land/std/examples/curl.ts' failed: 403 Forbidden

我只有使用手机网络才能正常下载代码 `(>﹏<)′

明天就好了,你懂滴

后期我会做一个国内同步镜像源

4 个赞

希望吧

坐等

解决了吗老哥 :smiley:

还没

我在安装用 Deno 改造的 pagic 的时候也遇到了网络问题,有人知道如何操作嘛?

P.S: 浏览器打开 https://raw.githubusercontent.com/pillarjs/path-to-regexp/v6.1.0/src/index.ts 是可以的;
P.S: 我局部代理、全局代理、不开代理各种情况下都是这个报错。

$ deno install --unstable --allow-read --allow-write --allow-net https://deno.land/x/pagic/mod.ts

Download https://deno.land/x/pagic/mod.ts
Compile https://deno.land/x/pagic/mod.ts
Download https://deno.land/x/pagic/src/Pagic.ts
...
Download https://deno.land/x/media_types@v2.3.5/mod.ts
Download https://raw.githubusercontent.com/pillarjs/path-to-regexp/v6.1.0/src/index.ts
error: Uncaught Http: error sending request for url (https://raw.githubusercontent.com/pillarjs/path-to-regexp/v6.1.0/src/index.ts): error trying to connect: tcp connect error: Connection refused (os error 61)
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
    at async processImports ($deno$/compiler.ts:736:23)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)
    at async processImports ($deno$/compiler.ts:753:7)

根据我目前的水平进行了 curl 测试,报错如下:

curl -fsSL https://raw.githubusercontent.com/pillarjs/path-to-regexp/v6.1.0/src/index.ts
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

目前还没搜到相关解决方案…

百度一下: 解决raw.githubusercontent.com无法访问的问题

windows:

用管理员权限编辑 C:\Windows\System32\drivers\etc\hosts 文件

Ubuntu,CentOS及macOS

直接在终端输入

sudo vi /etc/hosts

修改hosts文件, 添加一行

199.232.68.133 raw.githubusercontent.com
1 个赞

我按照这个方法修改 hosts 文件后仍然不行,非代理状态一直卡在 Download,代理之后报错如下

error: error sending request for url (https://deno.land/std/examples/curl.ts): error trying to connect: tcp connect error: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (os error 10060)

:rofl: 感谢!我的 hosts 修改后成功了。虽然知道搜索引擎大法,但是有时候真的难以想到往那方便想,我又得去继续解决下一个报错了 :woozy_face:

还是公司的 fq 给力。。。

https://github.com/denoland/deno/issues/5296 和这个issues 的问题是相同的,可惜的是它到现在为止也没有解决方案

https://github.com/denoland/deno/issues/5538 这里说是证书的问题

在不开代理的情况下报的是 403 Forbidden 的错,这似乎是因为 deno.land 使用的 cdn 加速商进行的限制,他要进行人机校验…

https://github.com/denoland/deno_website2/issues/1093 与作者讨论后,他下调了 cdn 的安全级别,我这边没有再报 403 的错误了 :grin:

1 个赞

deno 1.5安装demo也遇到这个问题了……

目前解决办法是把梯子撤掉,然后就正常安装运行了

类似 registry.npm.taobao.org 么?

你好,error trying to connect: invalid dnsname,这个问题有什么解决方案吗