2

我正在探索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-netdeno 权限的错误使用,但我尝试过一次在没有特定版本的情况下重新加载服务器以进行 drash 并且它有效。

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

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

谢谢

4

1 回答 1

1

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";
于 2020-05-20T14:30:15.963 回答