-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add nvm exec and nvm run commands #207
Comments
Can you tell me more about why you're using |
I have a global custom command which requires node 18, but I have local projects that require node 16, so I need |
So, this just switches to the specified version, runs the command, and switches back. Unless the version isn't installed. Have you run into any issues with your function? |
If these commands were added, what would be the reason for both? I am all for the minimalistic approach with having as few commands as possible. @asportnoy is there a reason you have not put that command (.js file) in your #!/home/userA/.local/share/nvm/v18.16.0/bin/node
// js content here Then just execute it like |
Thank you for clarifying, @thernstig. I actually didn't realize we were discussing two commands! It seems that their similar names had me confused. |
@jorgebucaran kinda. It doesn't actually switch, it just gets the path to the executable with the correct node version and runs it. You can look at the code above to see how I implemented it. |
That is an option for this specific scenario not it's not as clean IMO. Plus, you can't use it for |
Implementing either nvm exec or nvm run would do, correct? |
If you were to only add one, it should definitely be |
Absolutely! Send me PR and we can polish it together? |
Like the official
nvm
command, add anvm exec
subcommand which allows you to execute something one-off with a different version. For example,nvm exec 16 node index.js
. There's also anvm run
command which works likeexec
except you don't need to specifynode
(exec
can also be used withnpm
,npx
, etc)The text was updated successfully, but these errors were encountered: