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
Doc: how to use nvm from non-interactive shell #1959
Comments
It doesn’t require an interactive shell, but it does require a login shell. You may be interested in the existing `nvm-exec command, that does what you want - it’s been around for a few years. |
I've looked at So, reasons I prefer this
|
ah, that makes sense. As for poor docs on nvm-exec, that is indeed a problem, but that's fixable with a PR :-) |
Well, the name shouldn't be confused with an existing command, so On documenting |
As
nvm
is implemented as a shell function, it won't work in non-interactive shells where the shell initialization (e.g..bashrc
) isn't performed. To make this easier, how about adding the following tool to the documentation (with a suggested name ofnvm-run
):This could then be used to execute any desired
nvm
command, e.g. (in Ubuntu 18, withnvm
initialization in.bashrc
disabled):(Note: for some reason this doesn't seem to work with
./nvm-run current
(it always reports "system"), but since most people will use this to run a command with a specific version of node this may not be a problem.)If this works for the
nvm
developers, I'd be happy to submit a pull request; alternately, I'd be fine with someone else adding this to the doc.The text was updated successfully, but these errors were encountered: