Skip to content

Instantly share code, notes, and snippets.

@jeremedia
Created October 30, 2023 17:09
Show Gist options
  • Save jeremedia/679a6307c3069e35579428eba10063eb to your computer and use it in GitHub Desktop.
Save jeremedia/679a6307c3069e35579428eba10063eb to your computer and use it in GitHub Desktop.
Loading NVM in non-interactive shells
From: https://github.com/koenpunt/capistrano-nvm/issues/25#issuecomment-320825075
Put your NVM source script in your .bashrc which is still evaluated even during an non-interactive SSH session. Just make sure you place the declarations at the top, before the case statement:
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
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment