Leokuma
Leokuma3w ago

Running multiple Deno versions at the same time

Is it safe to run multiple Deno versions on the same machine at the same time or is there a risk of some sort of conflict due to dependency caching, shared directories and friends?
6 Replies
Deno AI Helper
I wasn't able to find the answer to your question in the official Deno documentation. However, based on general knowledge of how Deno operates, each Deno process should be isolated and maintain its own cache, as long as you specify different DENO_DIR locations for each version to avoid any conflicts with dependency caching. Deno uses the DENO_DIR environment variable to determine where to cache dependencies, so you can run multiple versions of Deno on the same machine by setting a different DENO_DIR for each one. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice, perhaps by experimenting with different versions in a controlled environment or reaching out to the Deno community for further insights.
German_Noob
German_Noob3w ago
I am kind of interested in what your use-case for running multiple versions of deno is. In general I would think that it should be safe to run multiple versions. If you do a version update you keep using the same caches and all so the structure and format of those files and folders probably don't change much. There is a good chance for conflicts if two programs try to pull the same dependency at the same time but I think that is relatively unlikely to happen. I think it's best to just try it out
Leokuma
Leokuma3w ago
Hi, thanks for answering My use case is I have a server (VPS) where I have something like a Deno cluster - or Deno "microservices" - and I'd like to upgrade the Deno version only for one service. I don't want to use Docker
pyrote
pyrote3w ago
What about having a user account per Deno version? Then all the caches and dependencies would be confined to that home directory or User Profile.
jeff.hykin
jeff.hykin3w ago
Yes there is risk, I run multiple versions every day. The risk I know about is lock file format conflicts. Starting with deno 1.27.2 (I believe) the --no-lock file argument was added. If you always use that argument, and install each deno to a different location (I use ~/.deno/[denoVersion]/) then I don't think there will be any issues; even without keeping caches separate. I've been doing that for years on my local machine. Not necessarily bulletproof but to my knowledge everything in the cache is either address hashed, content address hashed, or version-prefixed. AFAIK deno only accesses home, tmp, and cache. So if you keep those three things separate per deno instance, I think that would be a bulletproof solution. You dont even need multiple users, just change HOME in the call to Deno.
Leokuma
Leokuma3w ago
Thank you so much for the ideas guys :deno_thumbs_up: