0
votes

I am following these instructions:

https://keymetrics.io/2015/02/03/installing-node-js-and-io-js-with-nvm/

and running this curl request:

curl https://raw.githubusercontent.com/creationix/nvm/v0.23.2/install.sh | bash

It opens my bash_profile (not my bashrc?) and nothing changes. I then do not have the npm command available to me in my bash and there is no .nvm file in my home directory and node -v doesn't work. Any ideas on what might be going wrong?

1

1 Answers

0
votes

The NVM documentation says that the installation script will try to add the source line to your ~/.bash_profile:

The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc or ~/.profile).

And probably you are loading your ~/.bashrc when opening your terminal without a reference to the ~/.bash_profile so you are not 'sourcing' the nvm script.

Try adding these lines to your ~/.bashrc and restart your terminal:

export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

(I'm assuming that ~/.nvm is your NVM installation directory).

Extra: You can check this link to learn about the difference between .bashrc and _bash_profile