nvm command not available in bash script

nvm command is a shell function declared in ~/.nvm/nvm.sh.

You may source either of following scripts at the start of yours to make nvm() available:

. ~/.nvm/nvm.sh
. ~/.profile
. ~/.bashrc
. $(brew --prefix nvm)/nvm.sh  # if installed via Brew

If you installed it via brew on OSX, then you can load the brew sourced script into the script env by sourcing it as it details on the install.

I have this in projects to bootstrap them :

brew install nvm
. $(brew --prefix nvm)/nvm.sh
nvm install
...