Install nvm and create hotfix for
nvm install
command on FreeBSD.
echo "y" | pkg install bash git gmake wget
cat <<EOT >> $HOME/.profile
CC=$(which cc)
export CC
CXX=$(which c++)
export CXX
EOT
. $HOME/.profile
Run nvm install script. The script clones the nvm repository to ~/.nvm and adds the source line to your profile.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm install `nvm version-remote`
node -v
npm -v