Skip to content

-bash: nvm: command not found #576

Closed
@apaternite

Description

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

Activity

ljharb

ljharb commented on Nov 13, 2014

@ljharb
Member

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?

added
needs followupWe need some info or action from whoever filed this issue/PR.
on Nov 13, 2014
ljharb

ljharb commented on Nov 22, 2014

@ljharb
Member

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

alfredbez

alfredbez commented on Dec 4, 2014

@alfredbez

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

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

ljharb commented on Dec 4, 2014

@ljharb
Member

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

am11 commented on Jan 16, 2015

@am11

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

jeancdc commented on Apr 4, 2015

@jeancdc

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

ljharb commented on Apr 4, 2015

@ljharb
Member

@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

jeancdc commented on Apr 4, 2015

@jeancdc
  • 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

ljharb commented on Apr 4, 2015

@ljharb
Member

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

ljharb commented on Apr 4, 2015

@ljharb
Member

@jeancdc does that fix your issue?

jeancdc

jeancdc commented on Apr 5, 2015

@jeancdc

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

jeancdc

jeancdc commented on Apr 5, 2015

@jeancdc

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

ljharb commented on Apr 5, 2015

@ljharb
Member

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

190 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    installing nvm: profile detectionIssues with nvm's own install script, related to figuring out the right profile file.needs followupWe need some info or action from whoever filed this issue/PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @egoens@ljharb@creationix@ahimsauzi@vikramvi

        Issue actions

          -bash: nvm: command not found · Issue #576 · nvm-sh/nvm