-bash: nvm: command not found #576

Closed
apaternite opened this Issue Nov 12, 2014 · 125 comments

Comments

Projects
None yet
@apaternite

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?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Nov 13, 2014

Collaborator

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?

Collaborator

ljharb commented Nov 13, 2014

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?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Nov 22, 2014

Collaborator

Please reopen if you discover this is actually a problem with nvm.

Collaborator

ljharb commented Nov 22, 2014

Please reopen if you discover this is actually a problem with nvm.

@ljharb ljharb closed this Nov 22, 2014

@alfredbez

This comment has been minimized.

Show comment
Hide comment
@alfredbez

alfredbez Dec 4, 2014

I had the same issue until I added the following lines to my .bash_profile

export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh

I had the same issue until I added the following lines to my .bash_profile

export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Dec 4, 2014

Collaborator

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?

Collaborator

ljharb commented Dec 4, 2014

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?

@am11

This comment has been minimized.

Show comment
Hide comment
@am11

am11 Jan 16, 2015

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).

am11 commented Jan 16, 2015

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).

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 4, 2015

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 commented Apr 4, 2015

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 ?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 4, 2015

Collaborator

@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?

Collaborator

ljharb commented Apr 4, 2015

@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?

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 4, 2015

  • I've removed the source ~/.nvm/nvm.sh line,
  • 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...

jeancdc commented Apr 4, 2015

  • I've removed the source ~/.nvm/nvm.sh line,
  • 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...

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 4, 2015

Collaborator

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
Collaborator

ljharb commented Apr 4, 2015

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
@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 4, 2015

Collaborator

@jeancdc does that fix your issue?

Collaborator

ljharb commented Apr 4, 2015

@jeancdc does that fix your issue?

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

It was already two lines. Maybe I made wrong when I copied-paste this.
But still the same problem... :-(

jeancdc commented Apr 5, 2015

It was already two lines. Maybe I made wrong when I copied-paste this.
But still the same problem... :-(

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

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 commented Apr 5, 2015

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 !

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

@jeancdc Usually the install script does it for you, so nothing is needed in the readme. what OS are you using?

Collaborator

ljharb commented Apr 5, 2015

@jeancdc Usually the install script does it for you, so nothing is needed in the readme. what OS are you using?

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

I use Mac OS X 10.10.2 Yosemite

jeancdc commented Apr 5, 2015

I use Mac OS X 10.10.2 Yosemite

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

@jeancdc I'm not sure how you installed nvm, but the install script should have done that for you. How did you install it?

Collaborator

ljharb commented Apr 5, 2015

@jeancdc I'm not sure how you installed nvm, but the install script should have done that for you. How did you install it?

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

with this command:
curl https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | bash

jeancdc commented Apr 5, 2015

with this command:
curl https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | bash

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

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.

Collaborator

ljharb commented Apr 5, 2015

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.

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

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

jeancdc commented Apr 5, 2015

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
@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

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.

Collaborator

ljharb commented Apr 5, 2015

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.

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

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.

jeancdc commented Apr 5, 2015

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.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

Gotcha, thanks. Adding source ~/.bashrc to your .bash_profile would have resolved it as well.

Collaborator

ljharb commented Apr 5, 2015

Gotcha, thanks. Adding source ~/.bashrc to your .bash_profile would have resolved it as well.

@jeancdc

This comment has been minimized.

Show comment
Hide comment
@jeancdc

jeancdc Apr 5, 2015

So, does that mean that the install script of NVM need some fix ?

jeancdc commented Apr 5, 2015

So, does that mean that the install script of NVM need some fix ?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 5, 2015

Collaborator

Yes, #592 is probably the closest issue to it.

Collaborator

ljharb commented Apr 5, 2015

Yes, #592 is probably the closest issue to it.

@wonderdogone

This comment has been minimized.

Show comment
Hide comment
@wonderdogone

wonderdogone Jul 14, 2015

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

in /etc/profile worked for me

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

in /etc/profile worked for me

@ysk8

This comment has been minimized.

Show comment
Hide comment
@ysk8

ysk8 Aug 6, 2015

The solution of @wonderdogone works for me. Before, I tried the solutions suggested by @ljharb in response to @jeancdc.

Is possible that the problem is related with the permissions of the .bashrc file?

Is the best way to solve this issue, edit the profile file like @wonderdogone comment? Again, that solution works for me too.

ysk8 commented Aug 6, 2015

The solution of @wonderdogone works for me. Before, I tried the solutions suggested by @ljharb in response to @jeancdc.

Is possible that the problem is related with the permissions of the .bashrc file?

Is the best way to solve this issue, edit the profile file like @wonderdogone comment? Again, that solution works for me too.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Aug 6, 2015

Collaborator

The installation script's primary jobs are:

  • download nvm to $HOME/.nvm
  • add the "source nvm" lines to the appropriate shell profile file.

The second one is extremely difficult and error-prone. If at any time it fails for you, adding those two lines (#576 (comment)) to the appropriate profile file for your shell should solve it.

Collaborator

ljharb commented Aug 6, 2015

The installation script's primary jobs are:

  • download nvm to $HOME/.nvm
  • add the "source nvm" lines to the appropriate shell profile file.

The second one is extremely difficult and error-prone. If at any time it fails for you, adding those two lines (#576 (comment)) to the appropriate profile file for your shell should solve it.

@OClement

This comment has been minimized.

Show comment
Hide comment
@OClement

OClement Oct 21, 2015

I had that issue as well in Yosemite
I was using ~/.bashrc with no success
Replacing this file to use ~/.profile instead fixed the issue

It seems the .bashrc file isn't loaded anymore?

I had that issue as well in Yosemite
I was using ~/.bashrc with no success
Replacing this file to use ~/.profile instead fixed the issue

It seems the .bashrc file isn't loaded anymore?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 21, 2015

Collaborator

@OClement iirc it's not loaded by default in OS X unless bash_profile is not present. Do you have one of those?

Collaborator

ljharb commented Oct 21, 2015

@OClement iirc it's not loaded by default in OS X unless bash_profile is not present. Do you have one of those?

@OClement

This comment has been minimized.

Show comment
Hide comment
@OClement

OClement Oct 21, 2015

No I actually didn't have any of these files in my home folder (be it bashrc, profile, bash profile and the likes)

I have to say I never was really clear about the differences between one or the others

No I actually didn't have any of these files in my home folder (be it bashrc, profile, bash profile and the likes)

I have to say I never was really clear about the differences between one or the others

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 21, 2015

Collaborator

indeed, that's the issue - simply having an empty one of those should make the install script work.

Collaborator

ljharb commented Oct 21, 2015

indeed, that's the issue - simply having an empty one of those should make the install script work.

@OClement

This comment has been minimized.

Show comment
Hide comment
@OClement

OClement Oct 21, 2015

Good to know
Thanks for the precision!

Good to know
Thanks for the precision!

@creationix

This comment has been minimized.

Show comment
Hide comment
@creationix

creationix Oct 21, 2015

Owner

@jeancdc The README still has remains of my original instructions under the "Manual Install" section. https://github.com/creationix/nvm#manual-install

This does mention to add the source line to your shell's startup script.

Though if you want to see how little of my original code is left unmodified, run a git blame. @ljharb and other contributors have done amazing work with this project.

Owner

creationix commented Oct 21, 2015

@jeancdc The README still has remains of my original instructions under the "Manual Install" section. https://github.com/creationix/nvm#manual-install

This does mention to add the source line to your shell's startup script.

Though if you want to see how little of my original code is left unmodified, run a git blame. @ljharb and other contributors have done amazing work with this project.

@reinis-zumbergs

This comment has been minimized.

Show comment
Hide comment
@reinis-zumbergs

reinis-zumbergs Nov 30, 2015

This answer helped me on Mac OS X 10.11:
http://apple.stackexchange.com/a/119714
Basically it says that .bashrc is not loaded by Mac OS X, but .bash_profile is. So many put this in the latter:

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

Before nvm installation I had neither of the files. And the installation created .bashrc with the code already mentioned in above comments.

This answer helped me on Mac OS X 10.11:
http://apple.stackexchange.com/a/119714
Basically it says that .bashrc is not loaded by Mac OS X, but .bash_profile is. So many put this in the latter:

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

Before nvm installation I had neither of the files. And the installation created .bashrc with the code already mentioned in above comments.

@andreacab

This comment has been minimized.

Show comment
Hide comment
@andreacab

andreacab Dec 28, 2015

What @alfredbez recommended worked for me on OSX 10.11

What @alfredbez recommended worked for me on OSX 10.11

@timshaya

This comment has been minimized.

Show comment
Hide comment
@timshaya

timshaya Feb 5, 2016

This worked for me on OS X 10.10.4:

Adding source ~/.bashrc to your .bash_profile would have resolved it as well.

@ljharb thanks!

timshaya commented Feb 5, 2016

This worked for me on OS X 10.10.4:

Adding source ~/.bashrc to your .bash_profile would have resolved it as well.

@ljharb thanks!

@shennan

This comment has been minimized.

Show comment
Hide comment
@shennan

shennan Feb 12, 2016

I also didn't have any of the mentioned profiles in HOME. When installing nvm, no source scripts were added or modified. I had to create a ~/.profile file and add the lines from this comment.

shennan commented Feb 12, 2016

I also didn't have any of the mentioned profiles in HOME. When installing nvm, no source scripts were added or modified. I had to create a ~/.profile file and add the lines from this comment.

@jacky-jiang

This comment has been minimized.

Show comment
Hide comment
@jacky-jiang

jacky-jiang Jun 20, 2016

@ljharb As I installed the nvm using command "curl", definitely it appended
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm to .bashrc file.
But there are some difference between .bashrc and .bash_profile that would cause "nvm command not found" error when using nvm after installing.
For the detail of the difference, please refer to http://apple.stackexchange.com/questions/51036/what-is-the-difference-between-bash-profile-and-bashrc

jacky-jiang commented Jun 20, 2016

@ljharb As I installed the nvm using command "curl", definitely it appended
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm to .bashrc file.
But there are some difference between .bashrc and .bash_profile that would cause "nvm command not found" error when using nvm after installing.
For the detail of the difference, please refer to http://apple.stackexchange.com/questions/51036/what-is-the-difference-between-bash-profile-and-bashrc

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Jul 21, 2017

Collaborator

@BawLeeFanZ you're sourcing nvm.sh twice. You should remove the last two lines out of those 5.

Collaborator

ljharb commented Jul 21, 2017

@BawLeeFanZ you're sourcing nvm.sh twice. You should remove the last two lines out of those 5.

@MaxJaison

This comment has been minimized.

Show comment
Hide comment
@MaxJaison

MaxJaison Jul 24, 2017

@BawLeeFanZ i just paste this:

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

I didn`t paste this:

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

MaxJaison commented Jul 24, 2017

@BawLeeFanZ i just paste this:

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

I didn`t paste this:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
@BawLeeFanZ

This comment has been minimized.

Show comment
Hide comment
@BawLeeFanZ

BawLeeFanZ Jul 24, 2017

@ljharb Hi~ thank you for reply~
After deleted the last two lines, when I tried -v nvm still showing -bash: -v: command not found
And I also found that there isn't any ~/.zshrc, ~/.profile, or ~/.bashrc exist, should I touch them and add those two lines by myself?
According to the discussion above, it seems like adding
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completionin ~/.bash_profile is enough?

btw, my OS version is Sierra 10.12.5

p.s.1 Using the way that @MaxJaison mentioned also didn't work......
(update) 2.I installed the npm before nvm, is that the reason causing the issue?

BawLeeFanZ commented Jul 24, 2017

@ljharb Hi~ thank you for reply~
After deleted the last two lines, when I tried -v nvm still showing -bash: -v: command not found
And I also found that there isn't any ~/.zshrc, ~/.profile, or ~/.bashrc exist, should I touch them and add those two lines by myself?
According to the discussion above, it seems like adding
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completionin ~/.bash_profile is enough?

btw, my OS version is Sierra 10.12.5

p.s.1 Using the way that @MaxJaison mentioned also didn't work......
(update) 2.I installed the npm before nvm, is that the reason causing the issue?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Jul 24, 2017

Collaborator

@BawLeeFanZ not -v nvm, command -v nvm - include the word "command".

Yes, on OS X you can add those lines just to .bash_profile and that should be fine.

npm isn't installed by itself - it comes with node. It's fine if you have a system node; nvm will just shadow it as needed.

Collaborator

ljharb commented Jul 24, 2017

@BawLeeFanZ not -v nvm, command -v nvm - include the word "command".

Yes, on OS X you can add those lines just to .bash_profile and that should be fine.

npm isn't installed by itself - it comes with node. It's fine if you have a system node; nvm will just shadow it as needed.

@CrazyForName

This comment has been minimized.

Show comment
Hide comment
@CrazyForName

CrazyForName Sep 13, 2017

when I open the terminal ,it will show“ -bash: /usr/local/opt/nvm/nvm.sh: No such file or directory”
But I have add it to PATH.......

when I open the terminal ,it will show“ -bash: /usr/local/opt/nvm/nvm.sh: No such file or directory”
But I have add it to PATH.......

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Sep 13, 2017

Collaborator

@CrazyForName that means you installed it with homebrew; try brew uninstalling it, and removing all nvm-related lines from all your shell profile files, and then re-run the curl + install script (as documented in the readme)

Collaborator

ljharb commented Sep 13, 2017

@CrazyForName that means you installed it with homebrew; try brew uninstalling it, and removing all nvm-related lines from all your shell profile files, and then re-run the curl + install script (as documented in the readme)

@ZuyRzuuf

This comment has been minimized.

Show comment
Hide comment
@ZuyRzuuf

ZuyRzuuf Sep 13, 2017

If you use fish terminal nvm doesn't work. Only solution for me was change back to default bash.

If you use fish terminal nvm doesn't work. Only solution for me was change back to default bash.

@CrazyForName

This comment has been minimized.

Show comment
Hide comment
@CrazyForName

CrazyForName Sep 14, 2017

CrazyForName commented Sep 14, 2017

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Sep 19, 2017

Collaborator

@ZuyRzuuf yes, fish is not POSIX compliant, so nvm won't ever work on it.

Collaborator

ljharb commented Sep 19, 2017

@ZuyRzuuf yes, fish is not POSIX compliant, so nvm won't ever work on it.

@ahimsauzi

This comment has been minimized.

Show comment
Hide comment
@ahimsauzi

ahimsauzi Oct 11, 2017

Had the same issue on Mac OS Sierra (10.12.6). Manually adding the below code into my .bash_profile.
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

Had the same issue on Mac OS Sierra (10.12.6). Manually adding the below code into my .bash_profile.
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 11, 2017

Collaborator

@ahimsauzi that's what the install script should do for you; you may need to rerun it after updating the Mac OS (but you shouldn't have to)

Collaborator

ljharb commented Oct 11, 2017

@ahimsauzi that's what the install script should do for you; you may need to rerun it after updating the Mac OS (but you shouldn't have to)

@kushalmahajan

This comment has been minimized.

Show comment
Hide comment
@kushalmahajan

kushalmahajan Oct 11, 2017

As per the official docs. The text goes as below

Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)

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

As per the official docs. The text goes as below

Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)

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

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 11, 2017

Collaborator

@kushalmahajan yes, in the official docs under "git install"; but if you followed the install script instructions that isn't necessary.

Collaborator

ljharb commented Oct 11, 2017

@kushalmahajan yes, in the official docs under "git install"; but if you followed the install script instructions that isn't necessary.

@ahimsauzi

This comment has been minimized.

Show comment
Hide comment
@ahimsauzi

ahimsauzi Oct 11, 2017

@kushalmahajan I used the curl install script and it did not update my .bash_profile, .profile or .bashrc. Perhaps, it was a permission and adding sudo in front of it would have solved it? Either way, after adding the needed lines manually everything works as expected.

@kushalmahajan I used the curl install script and it did not update my .bash_profile, .profile or .bashrc. Perhaps, it was a permission and adding sudo in front of it would have solved it? Either way, after adding the needed lines manually everything works as expected.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 11, 2017

Collaborator

@ahimsauzi thanks, if you could file a new issue about that that'd be appreciated! sudo should never be required.

Collaborator

ljharb commented Oct 11, 2017

@ahimsauzi thanks, if you could file a new issue about that that'd be appreciated! sudo should never be required.

@kushalmahajan

This comment has been minimized.

Show comment
Hide comment
@kushalmahajan

kushalmahajan Oct 12, 2017

@ljharb. Indeed. Infact, I didn't encountered it in first go. My task was to update npm manually. So for that some commands led to nvm not found too. Anyway, idea was to help load nvm again( assuming any scenario which may have rendered it useless).

@ahimsauzi You can try doin vim .bashrc in your root user and so forth for other files and add the export statement manually.

kushalmahajan commented Oct 12, 2017

@ljharb. Indeed. Infact, I didn't encountered it in first go. My task was to update npm manually. So for that some commands led to nvm not found too. Anyway, idea was to help load nvm again( assuming any scenario which may have rendered it useless).

@ahimsauzi You can try doin vim .bashrc in your root user and so forth for other files and add the export statement manually.

@wreilly

This comment has been minimized.

Show comment
Hide comment
@wreilly

wreilly Oct 13, 2017

Issue:

I used the curl install script, and my .bash_profile did get updated.

But on my Mac OS X 10.11 El Capitan at least, the LINE ENDINGS turned out to be 0d 0a instead of what Mac wants - 0a.

This caused : command not found errors on opening a new Terminal window.

Debugging using $ bash --login -x revealed the complaints about the line endings (bit obliquely).

Bit of hexdump confirmed assumptions.

Manual Edit Fix:

As noted by others, manual edit to the .bash_profile (getting rid of the lines supplied by the curl install script) got things to work.

Notes:

$ bash --login -x
...
+ $'\r'
: command not found
+ $'\r'
: command not found
+ export $'NVM_DIR=/Users/william.reilly/.nvm\r'
+ NVM_DIR=$'/Users/william.reilly/.nvm\r'
+ '[' -s $'/Users/william.reilly/.nvm\r/nvm.sh' ']'
+ '[' -s $'/Users/william.reilly/.nvm\r/bash_completion' ']'
+ $'\r'
: command not found
+ $'\r'
: command not found
+ $'\r'
: command not found
...


http://www.rapidtables.com/convert/number/ascii-to-hex.htm

$ hexdump .bash_profile
(partial bit)

.nvm"
[

2e 6e 76 6d 22 0a 5b <<< As converted by online converter
2e 6e 76 6d 22 0d 0a 5b <<< MY TEXT FILE from Install Script has extra "0d"


re: 0a, 0d, 0d 0a

Test file contents: (Made with TextMate "Line Ending" options: LF, CR, CRLF)


line 1
line 2


$ hexdump .bash_profile_LF <<< 0a
0000000 6c 69 6e 65 20 31 0a 6c 69 6e 65 20 32 0a

$ hexdump .bash_profile_CRMacClassic <<< 0d
0000000 6c 69 6e 65 20 31 0d 6c 69 6e 65 20 32 0d

$ hexdump .bash_profile_CRLFWindows <<<< 0d 0a
0000000 6c 69 6e 65 20 31 0d 0a 6c 69 6e 65 20 32 0d 0a


wreilly commented Oct 13, 2017

Issue:

I used the curl install script, and my .bash_profile did get updated.

But on my Mac OS X 10.11 El Capitan at least, the LINE ENDINGS turned out to be 0d 0a instead of what Mac wants - 0a.

This caused : command not found errors on opening a new Terminal window.

Debugging using $ bash --login -x revealed the complaints about the line endings (bit obliquely).

Bit of hexdump confirmed assumptions.

Manual Edit Fix:

As noted by others, manual edit to the .bash_profile (getting rid of the lines supplied by the curl install script) got things to work.

Notes:

$ bash --login -x
...
+ $'\r'
: command not found
+ $'\r'
: command not found
+ export $'NVM_DIR=/Users/william.reilly/.nvm\r'
+ NVM_DIR=$'/Users/william.reilly/.nvm\r'
+ '[' -s $'/Users/william.reilly/.nvm\r/nvm.sh' ']'
+ '[' -s $'/Users/william.reilly/.nvm\r/bash_completion' ']'
+ $'\r'
: command not found
+ $'\r'
: command not found
+ $'\r'
: command not found
...


http://www.rapidtables.com/convert/number/ascii-to-hex.htm

$ hexdump .bash_profile
(partial bit)

.nvm"
[

2e 6e 76 6d 22 0a 5b <<< As converted by online converter
2e 6e 76 6d 22 0d 0a 5b <<< MY TEXT FILE from Install Script has extra "0d"


re: 0a, 0d, 0d 0a

Test file contents: (Made with TextMate "Line Ending" options: LF, CR, CRLF)


line 1
line 2


$ hexdump .bash_profile_LF <<< 0a
0000000 6c 69 6e 65 20 31 0a 6c 69 6e 65 20 32 0a

$ hexdump .bash_profile_CRMacClassic <<< 0d
0000000 6c 69 6e 65 20 31 0d 6c 69 6e 65 20 32 0d

$ hexdump .bash_profile_CRLFWindows <<<< 0d 0a
0000000 6c 69 6e 65 20 31 0d 0a 6c 69 6e 65 20 32 0d 0a


@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Oct 13, 2017

Collaborator

@wreilly would you mind filing a new issue? comments posted on old, closed issues are pretty hard for maintainers to locate and fix.

Collaborator

ljharb commented Oct 13, 2017

@wreilly would you mind filing a new issue? comments posted on old, closed issues are pretty hard for maintainers to locate and fix.

@winjeysong

This comment has been minimized.

Show comment
Hide comment
@winjeysong

winjeysong Oct 16, 2017

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

I just add codes above to .bash_profile, and it works.

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

I just add codes above to .bash_profile, and it works.

joshuacox added a commit to joshuacox/rxNstall that referenced this issue Dec 17, 2017

@rickshory

This comment has been minimized.

Show comment
Hide comment
@rickshory

rickshory Jan 2, 2018

Maybe this will help someone, as it took me quite a while to completely figure out. I am using Linux Mint, and other systems may be the same.
Installation of nvm went fine, but nvm would never be available in a new bash terminal window until I manually entered the two lines:

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

This was odd, because these two lines were already there, at the end of the initialization file "~/.profile".
The explanation is that bash uses a different chain of initialization files depending on whether it is being started as a login shell or non-login. This is spelled out in man bash, but rather cryptic as to how to tell.
The way to tell is type "echo $0" at the terminal prompt. If the response is "-bash" if it's a login shell, "bash" if not.
The shells I was getting from Ctrl-Alt-T were non-login, and so the system was looking for

~/.bashrc

instead of

~/.profile

But there was no such file. After I created it and put the initialization lines in it, now I get nvm available in every new terminal window, like I want.
Once you know whether you have login or non-login shells, you can consult man bash to decide where you want to put your initialization. The priority of the files is explained near the beginning of the documentation.
Another detail, which is of course obvious once you know, is that the nomenclature "~/.bashrc" means the file ".bashrc" in the home folder of the current user. So, for user "guest", the literal path would be "/home/guest/.bashrc". And, since the filename starts with a dot, it is a hidden file that won't normally show up. To see it in a GUI, you would need to do something like View > Show Hidden Files. To see it in a terminal window, you would enter "ls -a" at the prompt.

rickshory commented Jan 2, 2018

Maybe this will help someone, as it took me quite a while to completely figure out. I am using Linux Mint, and other systems may be the same.
Installation of nvm went fine, but nvm would never be available in a new bash terminal window until I manually entered the two lines:

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

This was odd, because these two lines were already there, at the end of the initialization file "~/.profile".
The explanation is that bash uses a different chain of initialization files depending on whether it is being started as a login shell or non-login. This is spelled out in man bash, but rather cryptic as to how to tell.
The way to tell is type "echo $0" at the terminal prompt. If the response is "-bash" if it's a login shell, "bash" if not.
The shells I was getting from Ctrl-Alt-T were non-login, and so the system was looking for

~/.bashrc

instead of

~/.profile

But there was no such file. After I created it and put the initialization lines in it, now I get nvm available in every new terminal window, like I want.
Once you know whether you have login or non-login shells, you can consult man bash to decide where you want to put your initialization. The priority of the files is explained near the beginning of the documentation.
Another detail, which is of course obvious once you know, is that the nomenclature "~/.bashrc" means the file ".bashrc" in the home folder of the current user. So, for user "guest", the literal path would be "/home/guest/.bashrc". And, since the filename starts with a dot, it is a hidden file that won't normally show up. To see it in a GUI, you would need to do something like View > Show Hidden Files. To see it in a terminal window, you would enter "ls -a" at the prompt.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Jan 15, 2018

I had a similar problem as #576 (comment). I use the Fish shell so I switch to bash by typing bash. That means it's not a login shell, and therefore .bash_profile wasn't respected. Putting

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

into .bashrc (not .bash_profile) solved it for me.

gaearon commented Jan 15, 2018

I had a similar problem as #576 (comment). I use the Fish shell so I switch to bash by typing bash. That means it's not a login shell, and therefore .bash_profile wasn't respected. Putting

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

into .bashrc (not .bash_profile) solved it for me.

@KUMARSUMIT585

This comment has been minimized.

Show comment
Hide comment
@KUMARSUMIT585

KUMARSUMIT585 Jan 17, 2018

hi experts ,
I am facing issue in installation please help

$ nvm install node
Local cache found: $NVM_DIR/.cache/src/node-v9.4.0/node-v9.4.0.tar.gz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/src/node-v9.4.0/node-v9.4.0.tar.gz
$>./configure --prefix=/c/Users/Sumit/.nvm/versions/node/v9.4.0 <
which: no python2.7 in (/c/Users/Sumit/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Sumit/bin:/c/ProgramData/Oracle/Java/javapath:/g/app/sumittech/product/12.2.0/dbhome_1/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Java/jre-9.0.1/bin:/c/Program Files/nodejs:/c/Program Files (x86)/Yarn/bin:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/Sumit/scoop/apps/nodejs/current/bin:/c/Users/Sumit/scoop/apps/nodejs/current:/c/Users/Sumit/scoop/apps/yarn/current/Yarn/bin:/c/Users/Sumit/scoop/apps/yarn/current/bin:/c/Users/Sumit/scoop/shims:/c/Users/Sumit/AppData/Local/Microsoft/WindowsApps:/c/Users/Sumit/AppData/Roaming/npm:/c/Users/Sumit/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no python2 in (/c/Users/Sumit/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Sumit/bin:/c/ProgramData/Oracle/Java/javapath:/g/app/sumittech/product/12.2.0/dbhome_1/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Java/jre-9.0.1/bin:/c/Program Files/nodejs:/c/Program Files (x86)/Yarn/bin:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/Sumit/scoop/apps/nodejs/current/bin:/c/Users/Sumit/scoop/apps/nodejs/current:/c/Users/Sumit/scoop/apps/yarn/current/Yarn/bin:/c/Users/Sumit/scoop/apps/yarn/current/bin:/c/Users/Sumit/scoop/shims:/c/Users/Sumit/AppData/Local/Microsoft/WindowsApps:/c/Users/Sumit/AppData/Roaming/npm:/c/Users/Sumit/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl)
./configure: line 3: exec: python: not found
nvm: install v9.4.0 failed!

regards
Sumit

KUMARSUMIT585 commented Jan 17, 2018

hi experts ,
I am facing issue in installation please help

$ nvm install node
Local cache found: $NVM_DIR/.cache/src/node-v9.4.0/node-v9.4.0.tar.gz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/src/node-v9.4.0/node-v9.4.0.tar.gz
$>./configure --prefix=/c/Users/Sumit/.nvm/versions/node/v9.4.0 <
which: no python2.7 in (/c/Users/Sumit/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Sumit/bin:/c/ProgramData/Oracle/Java/javapath:/g/app/sumittech/product/12.2.0/dbhome_1/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Java/jre-9.0.1/bin:/c/Program Files/nodejs:/c/Program Files (x86)/Yarn/bin:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/Sumit/scoop/apps/nodejs/current/bin:/c/Users/Sumit/scoop/apps/nodejs/current:/c/Users/Sumit/scoop/apps/yarn/current/Yarn/bin:/c/Users/Sumit/scoop/apps/yarn/current/bin:/c/Users/Sumit/scoop/shims:/c/Users/Sumit/AppData/Local/Microsoft/WindowsApps:/c/Users/Sumit/AppData/Roaming/npm:/c/Users/Sumit/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no python2 in (/c/Users/Sumit/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Sumit/bin:/c/ProgramData/Oracle/Java/javapath:/g/app/sumittech/product/12.2.0/dbhome_1/bin:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Java/jre-9.0.1/bin:/c/Program Files/nodejs:/c/Program Files (x86)/Yarn/bin:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/Sumit/scoop/apps/nodejs/current/bin:/c/Users/Sumit/scoop/apps/nodejs/current:/c/Users/Sumit/scoop/apps/yarn/current/Yarn/bin:/c/Users/Sumit/scoop/apps/yarn/current/bin:/c/Users/Sumit/scoop/shims:/c/Users/Sumit/AppData/Local/Microsoft/WindowsApps:/c/Users/Sumit/AppData/Roaming/npm:/c/Users/Sumit/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl)
./configure: line 3: exec: python: not found
nvm: install v9.4.0 failed!

regards
Sumit

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Jan 17, 2018

Collaborator

@KUMARSUMIT585 would you please file a separate issue for that? (Regardless, python is required to compile node)

Collaborator

ljharb commented Jan 17, 2018

@KUMARSUMIT585 would you please file a separate issue for that? (Regardless, python is required to compile node)

@jbburf

This comment has been minimized.

Show comment
Hide comment
@jbburf

jbburf Jan 18, 2018

Hi, I just installed nvm like the original posted stated and I am getting the same issues. I went to the github (https://github.com/creationix/nvm) and copied in the curl command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

I then restarted my terminal session (closed and opened new window as well as quit terminal and restarted it).

I am unable to use nvm I get:

-bash: nvm: command not found

This happens on both my Mac Pro and my Macbook Pro both running 10.13.2. I am following a video of node.js development and the video author does not have these problems: after install nvm commands work.

My $PATH is "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" and I've searched for both ~/.bashrc and ~/.bash_profile but I don't seem to have either of these files. Hopefully this is a simple issue and thanks in advance!

jbburf commented Jan 18, 2018

Hi, I just installed nvm like the original posted stated and I am getting the same issues. I went to the github (https://github.com/creationix/nvm) and copied in the curl command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

I then restarted my terminal session (closed and opened new window as well as quit terminal and restarted it).

I am unable to use nvm I get:

-bash: nvm: command not found

This happens on both my Mac Pro and my Macbook Pro both running 10.13.2. I am following a video of node.js development and the video author does not have these problems: after install nvm commands work.

My $PATH is "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" and I've searched for both ~/.bashrc and ~/.bash_profile but I don't seem to have either of these files. Hopefully this is a simple issue and thanks in advance!

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Jan 19, 2018

Collaborator

@jbburf ah, if you don't have either of those files, you'll have to manually create one (on a mac, you probably want ~/.bash_profile)

Collaborator

ljharb commented Jan 19, 2018

@jbburf ah, if you don't have either of those files, you'll have to manually create one (on a mac, you probably want ~/.bash_profile)

@jbburf

This comment has been minimized.

Show comment
Hide comment
@jbburf

jbburf Jan 19, 2018

Thanks @ljharb, if I create ~/.bash_profile and re-run the install it works. This would be a great thing to add to the installer.

jbburf commented Jan 19, 2018

Thanks @ljharb, if I create ~/.bash_profile and re-run the install it works. This would be a great thing to add to the installer.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Jan 19, 2018

Collaborator

@jbburf Creating bash_profile is a bit intrusive, so the installer is intentionally not doing that. However, it'd be great to add a PR with those instructions to the install script (on Mac), if you're open to submitting one :-D

Collaborator

ljharb commented Jan 19, 2018

@jbburf Creating bash_profile is a bit intrusive, so the installer is intentionally not doing that. However, it'd be great to add a PR with those instructions to the install script (on Mac), if you're open to submitting one :-D

@KrisSiegel

This comment has been minimized.

Show comment
Hide comment
@KrisSiegel

KrisSiegel Jan 24, 2018

Just to mention what my issue ended up being:

~/.bashrc and ~/.bash_profile were both not being executed on my Mac (running 10.11.6). I had to add the following code into ~/.profile to make it work (the installer would not do this):

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

Not sure why it has to be one and not the others but perhaps if the installer could detect this it could write to the correct file?

Just to mention what my issue ended up being:

~/.bashrc and ~/.bash_profile were both not being executed on my Mac (running 10.11.6). I had to add the following code into ~/.profile to make it work (the installer would not do this):

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

Not sure why it has to be one and not the others but perhaps if the installer could detect this it could write to the correct file?

@MatthewKosloski

This comment has been minimized.

Show comment
Hide comment
@MatthewKosloski

MatthewKosloski Mar 14, 2018

Hey, everyone. I'm trying to install NVM on My Mac (running OSX Yosemite 10.10.5).

I was using Node with Homebrew, but I found it difficult to manage Node with it so I uninstalled it and decided to go with NVM.

I did so by running these commands:

brew uninstall node
brew uninstall --force node

Now that Node is uninstalled via Homebrew, I went to try to install NVM via cURL.

I ran the cURL install script:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

I then tried to install the latest version of Node using:

nvm install node

I then got the "command not found" error:

-bash: nvm: command not found

I tried to resolve by re-running the cURL command and got this excerpt from the output (entire output excluded for brevity):

nvm source string already in /Users/Matthew/.bashrc

This implies that NVM has successfully been installed, correct?

As advised by the README, I restarted Terminal. Again, I got the same "command not found" error.

Additionally, as advised by the README, I checked to see if I have a .bash_profile file. I checked by running:

cat ~/.bash_profile

This provided the following output:

source ~/.profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

The README says to add source ~/.bashrc to the file. I can edit the file via Nano; however, I am conflicted. Will adding source ~/.bashrc to .bash_profile conflict with the already included source ~/.profile?

Thank you for the help!

Hey, everyone. I'm trying to install NVM on My Mac (running OSX Yosemite 10.10.5).

I was using Node with Homebrew, but I found it difficult to manage Node with it so I uninstalled it and decided to go with NVM.

I did so by running these commands:

brew uninstall node
brew uninstall --force node

Now that Node is uninstalled via Homebrew, I went to try to install NVM via cURL.

I ran the cURL install script:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

I then tried to install the latest version of Node using:

nvm install node

I then got the "command not found" error:

-bash: nvm: command not found

I tried to resolve by re-running the cURL command and got this excerpt from the output (entire output excluded for brevity):

nvm source string already in /Users/Matthew/.bashrc

This implies that NVM has successfully been installed, correct?

As advised by the README, I restarted Terminal. Again, I got the same "command not found" error.

Additionally, as advised by the README, I checked to see if I have a .bash_profile file. I checked by running:

cat ~/.bash_profile

This provided the following output:

source ~/.profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

The README says to add source ~/.bashrc to the file. I can edit the file via Nano; however, I am conflicted. Will adding source ~/.bashrc to .bash_profile conflict with the already included source ~/.profile?

Thank you for the help!

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Mar 14, 2018

Collaborator

@MatthewKosloski it shouldn't conflict; but another alternative is copying the nvm-related lines from your bashrc into your .profile.

Collaborator

ljharb commented Mar 14, 2018

@MatthewKosloski it shouldn't conflict; but another alternative is copying the nvm-related lines from your bashrc into your .profile.

@MatthewKosloski

This comment has been minimized.

Show comment
Hide comment
@MatthewKosloski

MatthewKosloski Mar 14, 2018

@ljharb Editing the ~/.bash_profile file resolved the issue. Thanks for the fast reply!

@ljharb Editing the ~/.bash_profile file resolved the issue. Thanks for the fast reply!

@SunXinFei SunXinFei referenced this issue in SunXinFei/sunxinfei.github.io Mar 19, 2018

Open

安装NVM在mac中,nvm: command not found #6

@deelydian

This comment has been minimized.

Show comment
Hide comment
@deelydian

deelydian Apr 9, 2018

Hey guys, I'm running into the "-bash: -v: command not found" issue after installing nvm. I have run through a bunch of the solutions that seemed to have worked for other people above, but nothing is working for me.

I am running MacOS 10.13.4, and it appears that NVM finishes installation after running the terminal command: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

However, I then try to confirm the installation with "-v nvm" and I get the "command not found" result.

I do have a .bash_profile, and here are the contents:

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

I tried adding

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

to the bottom of the .bash_profile file, but it did not fix the problem.

Thanks in advance for any help you can provide.

Hey guys, I'm running into the "-bash: -v: command not found" issue after installing nvm. I have run through a bunch of the solutions that seemed to have worked for other people above, but nothing is working for me.

I am running MacOS 10.13.4, and it appears that NVM finishes installation after running the terminal command: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

However, I then try to confirm the installation with "-v nvm" and I get the "command not found" result.

I do have a .bash_profile, and here are the contents:

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

I tried adding

export NVM_DIR=$HOME/.nvm
source $NVM_DIR/nvm.sh

to the bottom of the .bash_profile file, but it did not fix the problem.

Thanks in advance for any help you can provide.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Apr 10, 2018

Collaborator

@deelydian could you file a new issue for that?

Collaborator

ljharb commented Apr 10, 2018

@deelydian could you file a new issue for that?

@deelydian

This comment has been minimized.

Show comment
Hide comment
@deelydian

deelydian Apr 10, 2018

@ljharb No problem at all...I just submitted a new issue. Sorry if my original comment was out of place here. And thank you very much for the response!

deelydian commented Apr 10, 2018

@ljharb No problem at all...I just submitted a new issue. Sorry if my original comment was out of place here. And thank you very much for the response!

@garrettH3S

This comment has been minimized.

Show comment
Hide comment
@garrettH3S

garrettH3S Apr 23, 2018

I had a similar issue using Capistrano to run npm commands (using nvm). My .bashrc file had the following right at the top,

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

which was causing me issues when running the capistrano commands. I solved this my moving the export NVM_DIR... above this case.

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
source $NVM_DIR/nvm.sh

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

I had a similar issue using Capistrano to run npm commands (using nvm). My .bashrc file had the following right at the top,

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

which was causing me issues when running the capistrano commands. I solved this my moving the export NVM_DIR... above this case.

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
source $NVM_DIR/nvm.sh

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac
@fijiwebdesign

This comment was marked as off-topic.

Show comment
Hide comment
@fijiwebdesign

fijiwebdesign May 14, 2018

For anyone wanting a specific version of node as default

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

# use node v9 becuase v10 is not supported by many projects
nvm alias default 9

For anyone wanting a specific version of node as default

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

# use node v9 becuase v10 is not supported by many projects
nvm alias default 9
@panec

This comment has been minimized.

Show comment
Hide comment
@panec

panec Jun 12, 2018

In my case it was a lack of the execute mode on the shell script. Calling
chmod 755 ~/.nvm/nvm.sh
fixed the issue.

panec commented Jun 12, 2018

In my case it was a lack of the execute mode on the shell script. Calling
chmod 755 ~/.nvm/nvm.sh
fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment