begoon
begoon6mo ago

deno cache

Does Deno bind cached packages per project? say, a particular concrete location of deno.json. Or the cache is global across the user, and one package when cached, can be taken from cache by Deno for any project?
3 Replies
begoon
begoonOP6mo ago
I have a weird situation when two projects have the INDENTICAL deno.json with import mappings. One project uses the cache without internet, but another tries to resolve it and fails without connectivity.
Deno AI Helper
Deno AI Helper6mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on my understanding of Deno's caching mechanism, Deno maintains a global cache for downloaded modules on the user's machine. This means that once a module is cached, it can be used by any project on the same machine without needing to be downloaded again. Please note that this advice is not directly from the Deno documentation, and I would recommend double-checking to ensure the accuracy of this information. You can also explore the cache directory yourself, which is typically located at $DENO_DIR (or %DENO_DIR% on Windows), to see how the modules are stored and referenced.
jeff.hykin
jeff.hykin6mo ago
AFAIK the bot is right. I'm not sure why it wouldve failed on the second project. If they were named or un-versioned modules in the deno.json instead of versioned https imports, they might check to see what the latest version is per-project. Project 1 might be lodash, and project 2 might be lodash, but they could be different versions of lodash depending on when the lock file was generated.

Did you find this page helpful?