I think you missed this step:
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it
https://github.com/creationix/nvm
Answer from Deepak Lamichhane on Stack OverflowI think you missed this step:
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it
https://github.com/creationix/nvm
Check your .bash_profile, .zshrc, or .profile file. You most likely had a problem during the installation.
You should have the following at the end of one of those files.
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM
The . $HOME/.nvm/nvm.sh is the same as source $HOME/.nvm/nvm.sh
See: Sourcing a File
You can also check to see if you have a .nvm folder.
ls -a | grep .nvm
If you're missing that folder then the installation failed to run the git command. This could be due to being behind a proxy. Try running the following instead.
git clone http://github.com/creationix/nvm.git .nvm
Videos
The problem is that you need nvm to be automatically sourced upon login, so either add the following line to your ~/.bashrc or ~/.profile file.
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
Also nvm doesn't set any version of node automatically so if you just installed nvm and installed a node version and try to use node the next time you login, you get an error that command not found: node unless you use the nvm use versionnumber command in every terminal session, so Instead I suggest you to set a default alias so that a default version of node is active for every terminal session using the following command
nvm alias default versionnumber
PS: In the above commands version number denotes the version number of nodejs that you have already installed using nvm
Simply Try
source ~/.nvm/nvm.sh- Then You Can Easily:
nvm install 0.10
First examine your actual "C:\Program Files\nodejs" directory. Most of us already have a "nodejs" directory from a prior install, before we decided (or were told) to install nvm.
In the end, this "C:\Program Files\nodejs" directory will actually be a shortcut to where nvm manages the versions it installs (see C:\Users\xxx\AppData\Roaming\nvm). It seems that nvm is simply switching the shortcut, when we call "nvm use ...".
Ok, so here is what I did to fix the situation where "nvm use ..." was not taking effect.
- Delete/remove/uninstall the version of node in your "C:\Program Files\nodejs" directory. To the point where there is no more "nodejs" directory at all.
- Delete the existence of nvm (C:\Users\xxx\AppData\Roaming\nvm), basically, manually delete the nvm dir.
- Download your desired version of nvm (https://github.com/coreybutler/nvm-windows/releases)
- Open a CMD prompt (run as administrator), and install the downloaded version of nvm, nvm-setup.exe, from within this CMD command prompt.
- From within the admin level command prompt, run "nvm install 7.2.1", or whatever node version you want to install. Probably you will be installing multiple versions, so repeat as needed.
- Now do the usual "nvm use ...", "nvm list", etc...
I dont know if this is the best way, but it worked for me...
Rename "C:\Program Files\nodejs" to "C:\Program Files\nodejsx"
nvm use x.x.x
This worked for me. Maybe it will work for you too.
FINAL EDIT: SOLVED! Refer to farverio's comment below regarding asdf as well as FreeAsInBeard's link for installation instructions. Many thanks to both of you guys!
Partially solved, explanation at the end of the post.
I've installed NVM and when I run 'nvm -v' it shows '0.39.1'.
I've run 'nvm install node' which was successful. However, upon running 'node -v' I get the 'Command 'node' not found' error.
Also, upon running 'nvm ls' I see a bunch of Node versions supposedly installed, but when I try to run 'nvm use <specific version>' I get the 'N/A: version "<specific version> -> N/A" is not yet installed. You need to run "nvm install <specific version> to install it before using it.' even though I've previously installed the specified version and it shows when I run 'nvm ls'.
How can I install NVM properly? I've watched a lot of tutorials and read a lot of posts, but none bring up the problem with being unable to actually use NVM (e.g., 'nvm use <specific version>' error).
Even after NVM reports successful Node installation it seems as it, in fact, wasn't successful. I feel as if I should completely remove NVM before reinstalling, although I might be wrong.
How can I remove NVM completely, install it properly and test it out?
Any help would be greatly appreciated!
I'm running Ubuntu 20.04.4 LTS.
Partial solution:
I've (seemingly) successfully removed NVM by running 'rm -rf ~/.nvm' but now I'm afraid of installing it again for the hundredth time because of it not working when I did so before.
Any guides on how to properly install NVM and test it out?
EDIT: Formatting.
If you run NVM-Windows, don't forget to run nvm on. (this solve the problem as title for me.)
I found out that this was a conflict with a previous versions of npm that have not been removed properly despite a apt-get remove node.
I solved it by reinstalling npm from scratch:
rm -R ~/.npm ~/.nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install node
To get the latest version, if you have jq:
tag=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r .tag_name)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$tag/install.sh | bash
nvm install node
I found the solution here.
Error: N/A: version "N/A -> N/A" is not yet installed
I got this error after doing nvm use (switching to older Node version 8.11.1, shown in .nvmrc file), nvm uninstall (newer Node version 9.0.0), then a git push.
nvm ls shows my "default" Node version was pointing to the uninstalled one: default -> 9.0.0 (-> N/A). This caused the error.
To fix: nvm alias default node points "default" to the latest installed Node version (8.11.1).
Now nvm ls shows default -> node (-> v8.11.1).
Turns out this error is telling me that I don't have it installed (ie the latest long term support version). To fix it, I had to run:
$ nvm install 'lts/*'
and it worked after that! Snagged from here