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

bash_completion file is not dowloaded when installing via install.sh (METHOD=script) #1588

Closed
matskiv opened this issue Aug 8, 2017 · 3 comments
Labels
installing nvm Problems installing nvm itself shell: bash/sh

Comments

@matskiv
Copy link

matskiv commented Aug 8, 2017

  • Operating system and version:
    macOS 10.12.5

  • How did you install nvm? (e.g. install script in readme, homebrew):
    install script (METHOD=script)

  • What steps did you perform?

$ curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh > nvm_install.sh
$ chmod +x nvm_install.sh 
$ export METHOD=script
$ ./nvm_install.sh
...
$ ls .nvm/
nvm-exec	nvm.sh
  • What happened?
    Only nvm-exec and nvm.sh were downloaded.
  • What did you expect to happen?
    $NVM_DIR/bash_completion should have been downloaded as well. It's referenced in .bashrc, and source .bashrc exits with code 1 because its missing.
  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
    Just this in .bashrc:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export LANG=en_US.UTF-8

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
@ljharb
Copy link
Member

ljharb commented Aug 8, 2017

[ -s "$NVM_DIR/bash_completion" ] ensures that if it doesn't exist, it won't evaluate the rest of the line; that shouldn't make things exit unless you've enabled set -e (which doesn't belong in a bashrc file, that's for sure).

Indeed, the script method only downloads nvm.sh and nvm-exec; I suppose we could add bash_completion too.

@ljharb ljharb closed this as completed in 3e1b459 Aug 8, 2017
@ljharb ljharb added installing nvm Problems installing nvm itself shell: bash/sh labels Aug 8, 2017
@matskiv
Copy link
Author

matskiv commented Aug 9, 2017

My problem was because this check: [ -s "$NVM_DIR/bash_completion" ] was on last line, and when bash_completion wasn't there it affected exit code of source .bashrc.

@ljharb Thank you for the fix. 👍
Btw: what criteria do you have for tagging new release ? I see that last one was back in April.

@ljharb
Copy link
Member

ljharb commented Aug 10, 2017

No criteria; mainly when I feel it's ready.

edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installing nvm Problems installing nvm itself shell: bash/sh
Projects
None yet
Development

No branches or pull requests

2 participants