为什么使用特定版本的 drash 会导致 deno 出错?

why drash with specific version causes error on deno?

我正在探索 deno。我在尝试启动我的(第一个 ::) deno 服务器时遇到问题,输出显示“404”

服务器文件如下:

import { Drash } from "https://deno.land/x/drash@v1.0.0-rc1/mod.ts";

const server = new Drash.Http.Server({
  response_output: "application/json",
  resources: [],
});

server.run({
  hostname: "localhost",
  port: 2803,
});

返回的命令:

➜  helloDeno deno run --allow-net app.ts
Compile file:///home/totone/dev/solo/projects/helloDeno/app.ts
Download https://deno.land/std@v1.0.0-rc1/http/server.ts
Download https://deno.land/std@v1.0.0-rc1/http/http_status.ts
Download https://deno.land/std@v1.0.0-rc1/testing/asserts.ts
Download https://deno.land/std@v1.0.0-rc1/io/bufio.ts
Download https://deno.land/std@v1.0.0-rc1/io/readers.ts
Download https://deno.land/std@v1.0.0-rc1/mime/multipart.ts
Download https://deno.land/std@v1.0.0-rc1/http/cookie.ts
error: Uncaught Error: Import 'https://deno.land/std@v1.0.0-rc1/io/readers.ts' failed: 404 Not Found
    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 compile ($deno$/compiler.ts:1316:31)
    at async tsCompilerOnMessage ($deno$/compiler.ts:1548:22)
    at async workerMessageRecvCallback ($deno$/runtime_worker.ts:74:9)

一开始,我认为 --allow-net deno 权限使用不当,但我尝试过一次重新加载服务器,但没有特定版本的 drash & 它成功了。

➜  helloDeno deno run --allow-net app.ts
Compile file:///home/totone/dev/solo/projects/helloDeno/app.ts

所以问题出在 @v1.0.0-rc1 软件包版本附近。谁能帮助我理解这种行为的原因?

谢谢

drash 正在尝试导入不存在的 https://deno.land/std@v1.0.0-rc1/io/readers.ts(和其他 std/@v1.0.0-rc1)。

std 当前版本是 v0.51.0


您应该使用 drash@v1.0.0,这是最新的 drash 版本并使用现有的 std 版本。

import { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts";