Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement nvm switch command #884

Open
xavierfoucrier opened this issue Nov 18, 2022 · 7 comments
Open

Implement nvm switch command #884

xavierfoucrier opened this issue Nov 18, 2022 · 7 comments
Labels
consider for rt Pinned for use in the rt project enhancement request

Comments

@xavierfoucrier
Copy link

Just a suggestion / idea, when working with NVM on multiple projects where NodeJS versions differs, it would be nice to have a simple command to easily "switch" between current NodeJS used version and the previous one.

Implementation example:

cd ./project-a
nvm use 18

cd ../project-b
nvm use 16

cd ../project-a
nvm switch  <-- switch to NodeJS v18

Note that nvm switch should do nothing if current/previous versions are the same, which is the case when called the first time.

@coreybutler coreybutler added enhancement request consider for rt Pinned for use in the rt project labels Nov 18, 2022
@coreybutler
Copy link
Owner

Correct me if I'm misinterpreting, but it seems like the value of this proposal is not needing to know what the prior version was... i.e. less mental overhead.

One of the planned features for Runtime are aliases, i.e. nvm use myprojectalias. Alternatively, many folks have requested .nvmrc support to automatically switch based on whatever is defined in the .nvmrc file within a project directory. I've been steadfast about not adding this to NVM4W, but I believe there is a place for it (or similar solution) in Runtime.

Bottom line, does your vision of switch concept offer something one of these other solutions doesn't?

@xavierfoucrier
Copy link
Author

Hello @coreybutler!

Thanks for your fast reply.
Of course I can confirm that it's just for less mental overhead when working on two or more projects.

I didn't know that you have planned to build an alias feature, looks like a good plan!
May be this could fit my needs to easily switch between Node versions.

It's just a proposal / idea that came to me when using NVM a day long.
If you think it's out of scope or useless, feel free to close it 😉

@coreybutler
Copy link
Owner

coreybutler commented Nov 21, 2022

Reducing mental overhead is not useless or out of scope. I just wanted to clearly define the challenge so the best solution surfaces. Whether it will be a switch statement or something else can be tested in early Runtime betas. I'll leave this open for further comments.

@github-actions github-actions bot added Stale Stale and removed Stale Stale labels Dec 21, 2022
@github-actions github-actions bot added the Stale Stale label Jan 21, 2023
@coreybutler coreybutler removed the Stale Stale label Jan 21, 2023
Repository owner deleted a comment from github-actions bot Jan 21, 2023
Repository owner deleted a comment from github-actions bot Jan 21, 2023
@github-actions
Copy link

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 github-actions bot added the Stale Stale label Feb 21, 2023
@xavierfoucrier
Copy link
Author

Just leaving a comment to prevent this from closing by @github-actions 😉

@github-actions github-actions bot removed the Stale Stale label Feb 22, 2023
@micky2be
Copy link

For anyone interested in a pseudo solution, I just spend a couple of hours writing a PowerShell script

This is for my personal use, but feel free to give it a try

@noooonee
Copy link

I also want to have a quick way to switch multiple projects. How about store project related information in a hidden sub-folder? Link reusable resources to a local repo -- Sound like how python venv been designed.

MoaresOliveira added a commit to MoaresOliveira/nvm-windows that referenced this issue Aug 21, 2024
We can use the alias to switch to a version or uninstal it.

This feature was mentioned in the issues coreybutler#884, coreybutler#478, coreybutler#466 and coreybutler#461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consider for rt Pinned for use in the rt project enhancement request
Projects
None yet
Development

No branches or pull requests

4 participants