nvm-windows icon indicating copy to clipboard operation
nvm-windows copied to clipboard

2022-02-03: CI/CD compatibility feature

Open earonesty opened this issue 2 years ago • 1 comments

nvm-windows cannot be used in parallel, or used in ci/cd runners that have more than 1 job running at once, because it modifys global values on the machine

It should be possible to use nvm for ci/cd & parallel jobs.

As a workaround, this: https://github.com/davfive/nvm-session works, but realistically, it's a hack that will stay out-of-sync with nvm-windows:

Simplest proposed solution would be to bake in an nvm path command

A low level path command can simply return a path, so it can be used in all scripts of any kind, leaving usage up to the user:

export PATH="$PATH:$(nvm path 10.4)"

a higher level helper: nvm-session.bat can be used directly as needed to make it easier to switch within a cmd or batch script

nvm-session 10.1.4

... do stuff

earonesty avatar Aug 03 '22 14:08 earonesty

The CI/CD use case provides a compelling reason for sessions, but this would require a complete re-engineering of NVM4W. The only way to handle that is through the use of a shim. On its own, Node isn't capable of having multiple versions installed (the msi installer actively prevents it), let alone run them in parallel.

NVM4W is supposed to be a version manager, not an environment manager. This is how the NVM4W and nvm (for *nix) projects started, but somewhere along the way nvm independently started adding features to make it more about environment management.

The workaround is to just reference the path. The path is always accessible at %NVM_HOME%\vX.X.X\node.exe where X.X.X is the version you want. I realize this doesn't automatically expand partials as a nvm path command could do, so that is something I could see adding.

The bigger challenge is there is a feature freeze. I'm trying to find time to work on Runtime), which is an environment manager (as opposed to a version manager). That said, npm path is a simple enough addition that I may be able to squeeze it in. Session management is outside the scope of this project though.

coreybutler avatar Aug 03 '22 14:08 coreybutler

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 03 '22 02:09 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Sep 10 '22 02:09 github-actions[bot]