D
Deno

help

`deno cache` with `node_modules_dir` moves sub-dependencies into `.deno/node_modules` dir

Mmindbyte1/19/2024
If I execute deno cache --node-modules-dir package-lock.json, a node_modules directory is created - which is fine. But all sub-dependencies are downloaded into node_modules/.deno/node_modules. Unfortunately esbuild can't find these sub-dependencies as they are not where they're expected, as they should be directly in node_modules. Is there a way to tell deno to put all dependencies and sub-dependencies directly into node_modules? NOTE: There's the NODE_PATH environment variable, but deno cache is still not npm compatible like that.
Mmarvinh.1/19/2024
The fact that transient dependencies are put into node_modules/.deno shouldn't matter. pnpm does the same thing. It sounds like something else is going on
Mmindbyte1/22/2024
@marvinh. Thank you for your answer! Sorry I didn't clarify this: I'm using esbuild, which expects all packages in node_modules directly, I guess. I don't want to use npm, so I did a deno cache instead to populate node_modules. Do I have a chance to not use NODE_PATH with esbuild?
Mmarvinh.1/22/2024
What's the error message that you're getting? Maybe it makes more sense to tackle it from that way. The way we layout the node_modules folder should already work with esbuild and the esbuild deno plugin.

Looking for more? Join the community!