lmdb-js icon indicating copy to clipboard operation
lmdb-js copied to clipboard

deno module doesn't exist

Open LAC-Tech opened this issue 3 years ago • 5 comments

Using the url in the docs:

Deno 1.19.0
exit using ctrl+d or close()
> import * as lmdb from "https://deno.land/x/lmdb/mod.t"
Download https://deno.land/x/lmdb/mod.t
Warning Implicitly using latest version (test-build) for https://deno.land/x/lmdb/mod.t
Download https://deno.land/x/lmdb@test-build/mod.t
Uncaught TypeError: Module not found "https://deno.land/x/lmdb/mod.t".
    at async <anonymous>:2:14

LAC-Tech avatar Apr 08 '22 23:04 LAC-Tech

Does it work if you explicitly use v2.2.6 (https://deno.land/x/[email protected]/mod.ts)?

(I didn't realize that non-semantic version tags are considered to be "latest" in Deno. And the next version is switching to using the NAPI interface for Deno, which probably will require Deno v1.22).

kriszyp avatar Apr 11 '22 04:04 kriszyp

Kind of. Results after running deno upgrade

Deno 1.20.5
exit using ctrl+d or close()
> import * as lmdb from "https://deno.land/x/lmdb/mod.t"
Download https://deno.land/x/lmdb/mod.t
Warning Implicitly using latest version (v2.3.0) for https://deno.land/x/lmdb/mod.t
Download https://deno.land/x/[email protected]/mod.t
Uncaught TypeError: Module not found "https://deno.land/x/lmdb/mod.t".
    at async <anonymous>:2:14
> import * as lmdb from "https://deno.land/x/[email protected]/mod.ts"
Download https://deno.land/x/[email protected]/mod.ts
Download https://deno.land/x/[email protected]/deps.ts
Download https://deno.land/x/[email protected]/external.js
Download https://deno.land/x/[email protected]/level.js
Download https://deno.land/x/[email protected]/open.js
Download https://deno.land/x/[email protected]/write.js
Download https://deno.land/x/[email protected]/util/when.js
Download https://deno.land/x/[email protected]/caching.js
Download https://deno.land/x/[email protected]/keys.js
Download https://deno.land/x/[email protected]/read.js
Download https://deno.land/x/[email protected]/util/RangeIterable.js
Check https://deno.land/x/[email protected]/mod.ts
Uncaught TypeError: TS2551 [ERROR]: Property 'dlopen' does not exist on type 'typeof Deno'. 'Deno.dlopen' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'open'?
let lmdbLib = Deno.dlopen(libPath, {
                   ~~~~~~
    at https://deno.land/x/[email protected]/mod.ts:28:20

    'open' is declared here.
      export function open(
                      ~~~~
        at asset:///lib.deno.ns.d.ts:831:19
    at async <anonymous>:2:14
>

LAC-Tech avatar Apr 11 '22 22:04 LAC-Tech

Yes, as the error states, you definitely have to run deno with the unstable flag to enable FFI. See https://github.com/DoctorEvidence/lmdb-js/tree/v2.2.6#deno for the all flags you will need to enable.

kriszyp avatar Apr 11 '22 23:04 kriszyp

Thanks, that clarifies things.

LAC-Tech avatar Apr 14 '22 04:04 LAC-Tech

In case you want to track the the upcoming changes, this is the PR for adding NAPI support to Deno, which lmdb-js will leverage in future versions to support the full set of lmdb capabilities: https://github.com/denoland/deno/pull/13633

kriszyp avatar Apr 14 '22 14:04 kriszyp