Nvm: a small issue found in documentation (git install part)

Created on 27 Apr 2020  路  12Comments  路  Source: nvm-sh/nvm

I found a small issue in git installation part, please refer to below screenshot
image

please use source nvm.sh rather than . nvm.sh

because it will get error in zsh

$ . nvm.sh
.: no such file or directory: nvm.sh

or you can use

$ . $PWD/nvm.sh

it should be an absolute path

All 12 comments

. is portable, it works in zsh - source is not.

Indeed, though, it should be something like . ${NVM_DIR:-$HOME/.nvm}/nvm.sh.

I use zsh and . is get error when . nvm.sh as I said.

As a comparison, I even changed to bash and . nvm.sh is work. Without absolute path, it works in bash.

When I raise the issue, I have done some search and find some conclusion in StackOverflow to support me, but I don't want to find the link.

You can try it.

You're right, . ./nvm.sh works in zsh, however.

yes, . ./nvm.sh works.

but source nvm.sh also works, why you said it not

It may work in zsh, but it doesn't also work in every other shell nvm supports. source is not portable, . is, at least with a dot or slash prefixed path.

ok, got it & learned some new, great!

A PR to fix this part of the docs would be appreciated.

PR is ready pending review https://github.com/nvm-sh/nvm/pull/2205

. is an alias for source

@Yash-Singh1 not in every shell.

Oh, ok.

Was this page helpful?
0 / 5 - 0 ratings