Hamet
Hamet5d ago

Error running deno

Hello :) I am very new to deno and need some help running basic stuff. I don't find proper documentation.
import { Application, Router } from "https://deno.land/x/oak/mod.ts"
import { viewEngine, dejsEngine, oakAdapter } from "https://deno.land/x/view_engine/mod.ts"


const app = new Application()
const router = new Router()

app.use(
viewEngine(oakAdapter, dejsEngine, {
viewRoot: `${Deno.cwd()}/static/templates`,
})
);

app.use(router.routes());
app.use(router.allowedMethods());


console.log("Listening on port 8000");
await app.listen({ port: 8000 });
import { Application, Router } from "https://deno.land/x/oak/mod.ts"
import { viewEngine, dejsEngine, oakAdapter } from "https://deno.land/x/view_engine/mod.ts"


const app = new Application()
const router = new Router()

app.use(
viewEngine(oakAdapter, dejsEngine, {
viewRoot: `${Deno.cwd()}/static/templates`,
})
);

app.use(router.routes());
app.use(router.allowedMethods());


console.log("Listening on port 8000");
await app.listen({ port: 8000 });
when trying to run this via
deno run main.ts
deno run main.ts
I get the error
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import db from "https://raw.githubusercontent.com/jshttp/mime-db/v1.52.0/db.json" assert {
type: "json",
};

at https://deno.land/x/media_types@v3.0.3/mod.ts:32:1
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import db from "https://raw.githubusercontent.com/jshttp/mime-db/v1.52.0/db.json" assert {
type: "json",
};

at https://deno.land/x/media_types@v3.0.3/mod.ts:32:1
How do I ignore this error? I tried via
"no-import-assertions"
"no-import-assertions"
but nothing changed
2 Replies
bartlomieju
bartlomieju5d ago
You can't ignore it. The dependency you're using is using a deprecated syntax. If you want to run. It you'd have to downgrade to Deno 1.46.3
Hamet
Hamet5d ago
I dont need to use it, is there anything similiar for my purpose? what I want is render my index.ejs so it can see my css files and get data to substitute I fixed my issue :)