-bash: nvm: command not found
Running terminal in Mac OS X Yosemite.
Followed the installation instructions and restarted terminal: curl https://raw.githubusercontent.com/creationix/nvm/v0.18.0/install.sh | bash
When using nvm I always get -bash: nvm: command not found
When installing again: => nvm is already installed in /Users/Tony/.nvm, trying to update => HEAD is now at 5f5eb47... v0.18.0
I do have npm already installed. Does that matter?
Having node and npm already installed doesn't matter.
However, you do need to nvm use before nvm will take over your PATH and let you use nvm's version of node.
Can you check your ~/.bash_profile and ~/.bashrc for the relevant nvm lines, and paste them here? Also, what does echo $PATH say on a new shell?
Please reopen if you discover this is actually a problem with nvm.
I had the same issue until I added the following lines to my .bash_profile
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
Hmm, install.sh should add those to .bashrc or .bash_profile for you, which if you'd manually created it, should be sourced inside bash_profile. Perhaps that's the issue, that bashrc exists but isn't sourced inside bash_profile?
I was having the same issue. After installing nvm, I had to exit from bash and re-login to make it work (I read it somewhere earlier). I think we should update the README.
Tried on CentOS 7 in VM (dev installation mode, CLI only).
Hi,
I've got the same problem on Mac OS X 10.10 Yosemite. I've installed nvm with the command : curl https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | bash
This add the following lines in my .bashrc file:
export NVM_DIR="/Users/jeancreuzedeschatelliers/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
And I also add the following line at the bottom of the same file:
source ~/.nvm/nvm.sh
But it doesn't work. I must execute this last command every time I want use nvm.
Any idea ?
@jeancdc . something and source something are the same, except that the . is more portable, so you should definitely remove that redundant source line.
However, unless you run something like nvm alias default stable, every shell is intended to start with nvm in a deactivated but available state. Perhaps that's the issue?
- I've removed the
source ~/.nvm/nvm.shline, - install a version of node with
nvm install 0.12.2 - use this default version of node with
nvm alias default 0.12.2
But still the same problem when I quit the terminal and restart it... I must execute source ~/.nvm/nvm.sh every time I launch the terminal...
export NVM_DIR="/Users/jeancreuzedeschatelliers/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm - this should be two lines, like so:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
@jeancdc does that fix your issue?
It was already two lines. Maybe I made wrong when I copied-paste this. But still the same problem... :-(
OK, I've done the same thing than @alfredbez and it works:
Like he said, I must to add the following lines at the end of the ~/.bash_profile file:
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
Maybe the author @creationix should add these instructions in the README.markdown file.
Thanks to you !
@jeancdc Usually the install script does it for you, so nothing is needed in the readme. what OS are you using?
I use Mac OS X 10.10.2 Yosemite
@jeancdc I'm not sure how you installed nvm, but the install script should have done that for you. How did you install it?
with this command:
curl https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | bash
yup, that should do it. On a hunch - do you use any other shells? What does ls -a ~ | \grep -e '^\.' output? (ie, what other dotfiles do you have)
It's possible that it's already in your .bashrc file, and the problem is just that your .bash_profile doesn't source .bashrc anywhere in it.
I use the default terminal.
This is the result of the command:
.
..
.CFUserTextEncoding
.DS_Store
.MacOSX
.MakeMKV
.OpenCobolIDE
.Scilab
.Trash
.WebStorm9
.Xauthority
.adobe
.android
.avidemux
.bash_history
.bash_profile
.bash_profile.macports-saved_2012-01-22_at_20:47:07
.bash_profile.macports-saved_2014-06-03_at_21:50:12
.bash_profile.macports-saved_2014-10-18_at_22:28:07
.bash_profile.pysave
.bash_profile.swo
.bashrc
.bundle
.cache
.codeintel
.composer
.config
.cordova
.cups
.dbus-keyrings
.dtLiteMacLicense.dat
.dvdcss
.eclipse
.eclipse_keyring
.f-secure
.filezilla
.fontconfig
.gem
.gitconfig
.gitignore_global
.gnome2
.goodsync
.gradle
.heroku
.hgignore_global
.idlerc
.inkscape-etc
.lincity-ng
.local
.m2
.macports
.matlab
.mkshrc
.mplayer
.mypaint
.nchsoftware
.netrc
.nexuiz
.node-gyp
.npm
.nvm
.pdfsam
.pgpass
.pia_manager
.pia_manager_crash.log
.plugman
.profile
.psql_history
.rnd
.rvm
.serverauth.81878
.serverauth.981
.sqlite_history
.ssh
.subversion
.swt
.thumbnails
.viminfo
.widelands
.windows-serial
.wine
.xinitrc.d
.zlogin
.zshrc
If you check .bashrc and .zshrc and .profile, do any of them contain the nvm sourcing lines?
If so, then it's that the install script's shell detection is a bit wonky.
Here is what there are in the ~/.bashrc file:
export NVM_DIR=« $HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Nothing in the ~/.zshrc and in the ~/.profile files related to NVM.