UN..D
UN..D

Reputation: 603

Unsupported media type was attempted to be imported as a module

I used denodb Lib from this link "https://deno.land/x/[email protected]/mod.ts" then I got the below Error:

error: Import 'https://raw.githubusercontent.com/denjucks/dex/master/mod.ts' failed: 404 Not Found
    at https://deno.land/x/[email protected]/deps.ts:3:0

That because the DEX library moved from this link "https://raw.githubusercontent.com/denjucks/dex/master/mod.ts".

So I tried this solution link (they forked denodb and changed the dex url in deps.ts ).

After that I got the below Error:

error: An unsupported media type was attempted to be imported as a module.
  Specifier: https://github.com/takxlz/denodb/blob/master/mod.ts
  MediaType: Unknown

Any idea how to solve this Error? (Also I tried clean cache but still same error happen)

Thanks.

Upvotes: 3

Views: 694

Answers (1)

Shivam Singla
Shivam Singla

Reputation: 2201

https://github.com/takxlz/denodb/blob/master/mod.ts is actually a GitHub page (HTML page- text/html). The Deno modules which are imported are either text/plain or application/typescript. So use the raw version of the file uploaded on GitHub-

import * as Denodb from "https://raw.githubusercontent.com/takxlz/denodb/master/mod.ts";
curl -I "https://github.com/takxlz/denodb/blob/master/mod.ts"
# - content-type: text/html; charset=utf-8

curl -I "https://raw.githubusercontent.com/takxlz/denodb/master/mod.ts"
# - content-type: text/plain; charset=utf-8

curl -I "https://deno.land/x/[email protected]/mod.ts"
# - content-type: application/typescript; charset=utf-8

Upvotes: 6

Related Questions