import - 错误:尝试将不支持的媒体类型作为模块导入
问题描述
这是我的deps.ts
文件:
deps.ts:
export {
Application,
Router,
Context,
send,
} from "https://deno.land/x/oak@v9.0.1/mod.ts";
export type { RouterContext } from "https://deno.land/x/oak@v9.0.1/mod.ts";
export { MongoClient } from "https://deno.land/x/mongo@v0.27.0/mod.ts";
export {
hashSync,
compareSync,
} from "https://deno.land/x/bcrypt@v0.2.4/mod.ts";
import "https://deno.land/x/dotenv@v3.0.0/load.ts";
export { create, verify, decode, getNumericDate, } from "https://deno.land/x/djwt@v2.4/mod.ts";
这是我认为错误来自的代码的一部分:
auth_controller.ts:
import {
create, verify, decode, getNumericDate, RouterContext, hashSync, compareSync
} from "../deps.ts";
import { userCollection } from "../mongo.ts";
import User from "../models/user.ts";
这是我收到的错误消息:
错误:尝试将不支持的媒体类型作为模块导入。说明符:file:///C:/NewP/app_back/controllers/auth_controller 媒体类型:未知
解决方案
我发现在其他应用程序文件之一中,我导入auth_controller
了没有.ts
扩展名的文件。我.ts
在该导入行的末尾添加了扩展名,问题解决了。
推荐阅读
- javascript - 我的 jquery 计数器正在混合元素 - 为什么?
- azure-active-directory - 不支持使用过滤器对用户对象进行增量查询?
- c# - 使用 AppDomain 将 DLL 作为嵌入式资源文件加载
- hybris - 为全局消息设置错误消息样式的正确方法是什么?
- javascript - 建议:单页应用架构问题
- python - 如何修复,元素
- cassandra - 出现错误:尝试进行增量修复时“无法混合顺序修复和增量修复”
- javascript - NPM 在 node_modules 下安装非根依赖项?
- javascript - 如何使 Javascript 代码分别为每个元素工作,以使用相同的 Javascript 代码在 HTML 中创建多个重复项
- r - 使用 R 包 rvest 从 transfermarkt 抓取