Error: 429 Too Many Requests while downloading deno imports

Error: 429 Too Many Requests while downloading deno imports

我正在使用带有 docker hayd/alpine-deno 图像的 deno 和 denon 监视文件更改。当我构建容器时,我得到 429 Too Many Requests importing the std dependencies:

...

Download https://deno.land/std@0.54.0/encoding/_yaml/type/int.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/map.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/merge.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/nil.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/omap.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/pairs.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/seq.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/set.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/str.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/binary.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/bool.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/float.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/int.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/map.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/merge.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/nil.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/omap.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/pairs.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/seq.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/set.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/str.ts

Download https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts

error: Import 'https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts' failed: 429 Too Many Requests

我的外部依赖项在 deps.ts 中,其中包含以下导入:

export { Application, Router } from 'https://deno.land/x/oak/mod.ts'
export { connect } from 'https://deno.land/x/redis/mod.ts'

除了 denon 导入的依赖项外,没有其他外部依赖项。

我使用的 Dockerfile 运行 它:

FROM hayd/alpine-deno:1.0.1

ENV DENO_DIR /cache

EXPOSE 4000

WORKDIR /app/

COPY . .

RUN deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
RUN deno cache src/deps.ts

ENTRYPOINT ["/root/.deno/bin/denon"]

CMD ["run", "--allow-net", "src/mod.ts"]

许多文件似乎已下载(或尝试下载、失败并重试)多次。这并不总是发生,但经常足以破坏构建自动化。有没有人遇到过类似的问题?缓存导入有问题吗?

Is it an issue with caching the imports?

不,缓存与它无关。

似乎 deno.land 有速率限制,而您超出了这些限制。您可以做的是直接使用 github,这很可能会有更高的限制。

供天龙使用

https://raw.githubusercontent.com/denosaurs/denon/master/denon.ts

您还可以更改代码依赖项:

https://deno.land/x/oak/mod.ts更改为https://raw.githubusercontent.com/oakserver/oak/master/mod.ts

而对于 redis 你应该使用 https://raw.githubusercontent.com/keroxp/deno-redis/master/mod.ts

https://deno.land/x 只不过是一个 URL 重写服务器,所以最后,你实际上是从 Github.

deno.land/x is a URL rewriting service for Deno scripts. The basic format of code URLs is https://deno.land/x/MODULE_NAME@BRANCH/SCRIPT.ts. If you leave out the branch, it will default to the module’s default branch, usually master.


您应该使用标记版本而不是 master 否则您的 docker 图像将不会始终具有相同的 Oak 代码。

对于v4.0.0

export { Application, Router } from 'https://github.com/oakserver/oak/blob/v4.0.0/mod.ts'
export { connect } from 'https://raw.githubusercontent.com/keroxp/deno-redis/v0.10.1/mod.ts

Deno 包管理器,很新。我检查了一下,Deno 团队仍在进行优化。

使用鼠兔,更好的支撑。

https://www.pika.dev/docs/

或:

https://denopkg.com/

denopkg 样本:

import { opn } from 'https://denopkg.com/hashrock/deno-opn/opn.ts'

opn('https://denopkg.com')