denodb: A dependency is broken
https://github.com/eveningkid/denodb/blob/master/deps.ts#L5 uses dex from https://raw.githubusercontent.com/Zhomart/dex/930253915093e1e08d48ec0409b4aee800d8bd0c/mod-dyn.ts, which depends on the latest version of Deno std: https://raw.githubusercontent.com/Zhomart/dex/930253915093e1e08d48ec0409b4aee800d8bd0c/lib-dyn/deps.ts
The latest version doesn’t seem to provide node/events anymore. Thus denodb is no longer installable:
error: Module not found "https://deno.land/std/node/events.ts".
at https://raw.githubusercontent.com/Zhomart/dex/930253915093e1e08d48ec0409b4aee800d8bd0c/lib-dyn/deps.ts:7:24
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 18
- Comments: 15 (2 by maintainers)
No need to use a fork, I was able to patch the imports by adding the following to
import_map.json, removingdeno.lock, and running again:I created a fix on my fork, just use like this:
export { Database, SQLite3Connector, Model, DataTypes, } from "https://raw.githubusercontent.com/jerlam06/denodb/master/mod.ts";I did a simple fix using the
scopesproperty of the import map syntax. Since Deno now supportsimportsandscopesproperties directly in thedeno.jsonfile, I created adeno.jsonfile in the project root and added this to it:Immediately fixed the issue for me.
hey there! I’m trying to apply this scopes as a temporary fix but when I try to build the docker image with deno app I still got the dependency broken…
Do I need to do any other change besides the scopes on
deno.json? Thanks!After investigating this further, I think we have two options:
Option 1: Go back to using the original
https://deno.land/x/dex/mod.tsinstead of Zhomart’s fork. The original rationale for the fork was:This doesn’t seem true, because
dex/mod.tsvendors all its dependencies. There are two dex versions:mod.jsandmod-dyn.js. Thedynversion uses “live” dependencies, so in that specific version there is the risk that Zhomart mentions. Butmod.jsvendors everything, so even if jspm-core updates their code, it won’t affect dex. Not sure if this is strictly true, since this change must have been done after hitting some problem. The downside of this approach is that we won’t get bugfixes to their dependencies, since they’re vendored.Option 2: Keep using
mod-dyn, but use another fork that keeps these dependencies up to date. There’s a PR on Zhomart’s fork that pins the dependencies tostd/node@0.177.0, but I think we should usenode:*instead, so I created a PR on the original dex that makes that change: https://github.com/aghussb/dex/pull/5Sweet, I’m glad to hear it worked for you.
Take care brotha!
@nberlette Thanks for answering! Dont worry for the late response, I have it working with the current version and just couldn’t update it with some new features.
I’m using the latest deno:alpine image as base, so it should work with the scopes properties on deno.json. However with the import_map.json it worked! I had tried it before but didn’t realise that on the DockerFile when I run de “deno cache” I haven’t copied all the files yet, just the deps.ts. Once I copied the import_map.json it build all the dependencies.
Thanks!!
@pvillaverde Sorry for the late response; hopefully you’ve got this figured out by now. I’m not too familiar with using Docker + Deno unfortunately, but have you tried applying the scopes in an
import_map.jsoninstead?Using the
importsandscopesproperty directly indeno.jsonis a relatively new feature. Not knowing what version of Deno you’re running, I’d say it might be plausible to try an import map instead (which have been supported since like, day 1).You can force the command to use the import map like so:
Let me know how it goes.
Awesome, thanks @hugopeixoto for all these details!
Let’s go with option 2, and if the pr does not get merged, we can directly use your fork too
@Jerlam06 Thanks! Dario