Skip to content

Instantly share code, notes, and snippets.

@grrowl grrowl/lazy-nvm.sh
Created Feb 24, 2020

Embed
What would you like to do?
#!/bin/bash
function lazy_nvm {
unset -f nvm
unset -f npm
unset -f node
unset -f npx
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # linux
[ -s "$(brew --prefix nvm)/nvm.sh" ] && source $(brew --prefix nvm)/nvm.sh # osx
}
# aliases
function nvm { lazy_nvm; nvm "$@"; }
function npm { lazy_nvm; npm "$@"; }
function node { lazy_nvm; node "$@"; }
function npx { lazy_nvm; npx "$@"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.