M!NDBYTE
M!NDBYTE12mo ago

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

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?
4 Replies
M!NDBYTE
M!NDBYTEOP12mo ago
NOTE: There's the NODE_PATH environment variable, but deno cache is still not npm compatible like that.
marvinh.
marvinh.12mo ago
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
M!NDBYTE
M!NDBYTEOP12mo ago
@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?
marvinh.
marvinh.12mo ago
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.

Did you find this page helpful?