错误:导入"https://deno.land/std@v0.51.0/io/util.ts"失败:404 未找到



我得到以下错误消息,但我不知道程序的哪个部分导致这个错误消息,因为我无法在我的应用程序中找到这些库的直接导入:

deno run --allow-net --allow-read --allow-write --unstable server.ts
Download https://deno.land/std@v0.51.0/io/util.ts
Download https://deno.land/std@v0.51.0/io/bufio.ts
Warning std versions prefixed with 'v' were deprecated recently. Please change your import to https://deno.land/std@0.51.0/io/util.ts 
(at https://deno.land/std@v0.51.0/io/util.ts)
Warning std versions prefixed with 'v' were deprecated recently. Please change your import to https://deno.land/std@0.51.0/io/bufio.ts (at https://deno.land/std@v0.51.0/io/bufio.ts)
error: Import 'https://deno.land/std@v0.51.0/io/util.ts' failed: 404 Not Found
at https://deno.land/x/dejs@0.7.0/vendor/https/deno.land/std/io/util.ts:1:0

有什么问题吗?我怎样才能找到并解决它?

使用Deno的依赖项检查器,您可以看到entrypoint模块中包含的所有依赖项的层次关系。像这样使用:

deno info [OPTIONS] [URL or FILE_PATH]

这里有一个例子来说明:

终端:

% ls
deps.ts     mod.ts      test.ts     test_deps.ts
% deno info test.ts
local: /Users/deno/example/test.ts
type: TypeScript
emit: /Users/deno/.deno/gen/file/Users/deno/example/test.ts.js
dependencies: 17 unique (total 107.24KB)
file:///Users/deno/example/test.ts (284B)
├─┬ file:///Users/deno/example/mod.ts (308B)
│ └─┬ file:///Users/deno/example/deps.ts (67B)
│   └─┬ https://deno.land/std@0.110.0/path/mod.ts (725B)
│     ├── https://deno.land/std@0.110.0/_util/os.ts (598B)
│     ├── https://deno.land/std@0.110.0/path/_interface.ts (728B)
│     ├─┬ https://deno.land/std@0.110.0/path/common.ts (1.16KB)
│     │ └─┬ https://deno.land/std@0.110.0/path/separator.ts (259B)
│     │   └── https://deno.land/std@0.110.0/_util/os.ts *
│     ├─┬ https://deno.land/std@0.110.0/path/glob.ts (12.36KB)
│     │ ├── https://deno.land/std@0.110.0/_util/os.ts *
│     │ ├─┬ https://deno.land/std@0.110.0/path/posix.ts (14.49KB)
│     │ │ ├── https://deno.land/std@0.110.0/path/_constants.ts (1.9KB)
│     │ │ ├── https://deno.land/std@0.110.0/path/_interface.ts *
│     │ │ └─┬ https://deno.land/std@0.110.0/path/_util.ts (3.62KB)
│     │ │   ├── https://deno.land/std@0.110.0/path/_constants.ts *
│     │ │   └── https://deno.land/std@0.110.0/path/_interface.ts *
│     │ ├── https://deno.land/std@0.110.0/path/separator.ts *
│     │ └─┬ https://deno.land/std@0.110.0/path/win32.ts (29.41KB)
│     │   ├── https://deno.land/std@0.110.0/_util/assert.ts (405B)
│     │   ├── https://deno.land/std@0.110.0/path/_constants.ts *
│     │   ├── https://deno.land/std@0.110.0/path/_interface.ts *
│     │   └── https://deno.land/std@0.110.0/path/_util.ts *
│     ├── https://deno.land/std@0.110.0/path/posix.ts *
│     ├── https://deno.land/std@0.110.0/path/separator.ts *
│     └── https://deno.land/std@0.110.0/path/win32.ts *
└─┬ file:///Users/deno/example/test_deps.ts (66B)
└─┬ https://deno.land/std@0.110.0/testing/asserts.ts (20.63KB)
├── https://deno.land/std@0.110.0/fmt/colors.ts (11.53KB)
└── https://deno.land/std@0.110.0/testing/_diff.ts (8.78KB)

人造示例中模块的文本内容:

deps.ts:

export * as path from "https://deno.land/std@0.110.0/path/mod.ts";

mod.ts:

import { path } from "./deps.ts";
const imageExtensions = new Set([
"apng",
"avci",
"avif",
"gif",
"heic",
"heif",
"jpeg",
"jpg",
"png",
"svg",
"webp",
]);
export function hasImageExtension(filePath: string): boolean {
return imageExtensions.has(path.extname(filePath).slice(1));
}

test_deps.ts:

export * from "https://deno.land/std@0.110.0/testing/asserts.ts";

test.ts:

import { assert } from "./test_deps.ts";
import { hasImageExtension } from "./mod.ts";
Deno.test("hasImageExtension", () => {
let filePath = "./images/logo.png";
assert(hasImageExtension(filePath));
filePath = "./images/README.txt";
assert(!hasImageExtension(filePath));
});

相关内容

最新更新