Homebrew安装nvm但是之后找不到nvm吗?

时间:2021-06-24 08:42:58

I'm using homebrew and oh-my-zsh on a fresh OSX 10.10.1 install. I got nvm via homebrew and then attempted to run it but says - zsh: command not found: nvm

我正在使用homebrew和oh-my-zsh来安装OSX 10.10.1。我通过homebrew获得了nvm,然后尝试运行它,但是说- zsh: command not found: nvm

Any idea what the problem is? I was able to install and use git just fine...

你知道问题出在哪里吗?我可以安装和使用git。

Homebrew安装nvm但是之后找不到nvm吗?

Homebrew安装nvm但是之后找不到nvm吗?

4 个解决方案

#1


57  

Did you follow the instructions listed in the caveats?

你遵循了警告中列出的说明了吗?

[~] brew info nvm
nvm: stable 0.20.0, HEAD
https://github.com/creationix/nvm
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Add the following to $HOME/.bashrc, $HOME/.zshrc, or your shell's
equivalent configuration file:

  source $(brew --prefix nvm)/nvm.sh

Node installs will be lost upon upgrading nvm. Add the following above
the source line to move install location and prevent this:

  export NVM_DIR=~/.nvm

Without the extra config it doesn't look like it will find NVM by default..

如果没有额外的配置,默认情况下不会找到NVM。

#2


22  

There are TWO things you need to do. Follow the caveats shown after installing nvm via brew, and THEN you need to activate/reload the .bash_profile changes.

你需要做两件事。遵循在通过brew安装nvm之后显示的说明,然后您需要激活/重新加载.bash_profile更改。

  1. Run brew install nvm
  2. 运行酿造安装nvm
  3. Follow caveats shown in console, mine were as follows, yours MAY be different!:
  4. 遵循控制台显示的警告,我的如下,您的可能不同!

Add the following to ~/.bash_profile or your desired shell configuration file:

添加以下内容到~/。bash_profile或所需的shell配置文件:

export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
  1. Run . ~/.bash_profile to apply the changes you made to your .bash_profile file
  2. 运行。~ /。将您对.bash_profile文件所做的更改应用到bash_profile。

#3


0  

The reason you would need to reload your bash profiles or any other bash files might be because the command nvm may not be a program but a function that is defined and can only be used if the corresponding bash file is sourced.

您需要重新加载您的bash概要文件或任何其他bash文件的原因可能是因为命令nvm可能不是一个程序,而是一个定义的函数,并且只能在对应的bash文件来源的情况下使用。

On a system that I checked

在我检查过的系统上

which nvm 

does not work but

不工作,但

nvm list

does. This means that you can use the word "nvm" to invoke something. That something isn't a program. In the current case, it is a function which can be verified by

所做的事。这意味着您可以使用“nvm”这个词来调用某些东西。那不是一个程序。在当前情况下,它是一个可以被验证的函数

typeset -F | grep -P ' nvm$'

which outputs

的输出

declare -F nvm

which means nvm is a function, whose body can be inspected by doing

这就意味着nvm是一个函数,它的主体可以用do来检查吗

type -F nvm

#4


0  

One possibility if brew was used is that the nvm may be unlinked, especially if it was installed by another MAC OS user.

如果使用brew的话,一种可能是nvm可能被断开连接,特别是如果它是由另一个MAC OS用户安装的。

In this case, execute:

在这种情况下,执行:

brew link nvm

#1


57  

Did you follow the instructions listed in the caveats?

你遵循了警告中列出的说明了吗?

[~] brew info nvm
nvm: stable 0.20.0, HEAD
https://github.com/creationix/nvm
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/nvm.rb
==> Caveats
Add the following to $HOME/.bashrc, $HOME/.zshrc, or your shell's
equivalent configuration file:

  source $(brew --prefix nvm)/nvm.sh

Node installs will be lost upon upgrading nvm. Add the following above
the source line to move install location and prevent this:

  export NVM_DIR=~/.nvm

Without the extra config it doesn't look like it will find NVM by default..

如果没有额外的配置,默认情况下不会找到NVM。

#2


22  

There are TWO things you need to do. Follow the caveats shown after installing nvm via brew, and THEN you need to activate/reload the .bash_profile changes.

你需要做两件事。遵循在通过brew安装nvm之后显示的说明,然后您需要激活/重新加载.bash_profile更改。

  1. Run brew install nvm
  2. 运行酿造安装nvm
  3. Follow caveats shown in console, mine were as follows, yours MAY be different!:
  4. 遵循控制台显示的警告,我的如下,您的可能不同!

Add the following to ~/.bash_profile or your desired shell configuration file:

添加以下内容到~/。bash_profile或所需的shell配置文件:

export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
  1. Run . ~/.bash_profile to apply the changes you made to your .bash_profile file
  2. 运行。~ /。将您对.bash_profile文件所做的更改应用到bash_profile。

#3


0  

The reason you would need to reload your bash profiles or any other bash files might be because the command nvm may not be a program but a function that is defined and can only be used if the corresponding bash file is sourced.

您需要重新加载您的bash概要文件或任何其他bash文件的原因可能是因为命令nvm可能不是一个程序,而是一个定义的函数,并且只能在对应的bash文件来源的情况下使用。

On a system that I checked

在我检查过的系统上

which nvm 

does not work but

不工作,但

nvm list

does. This means that you can use the word "nvm" to invoke something. That something isn't a program. In the current case, it is a function which can be verified by

所做的事。这意味着您可以使用“nvm”这个词来调用某些东西。那不是一个程序。在当前情况下,它是一个可以被验证的函数

typeset -F | grep -P ' nvm$'

which outputs

的输出

declare -F nvm

which means nvm is a function, whose body can be inspected by doing

这就意味着nvm是一个函数,它的主体可以用do来检查吗

type -F nvm

#4


0  

One possibility if brew was used is that the nvm may be unlinked, especially if it was installed by another MAC OS user.

如果使用brew的话,一种可能是nvm可能被断开连接,特别是如果它是由另一个MAC OS用户安装的。

In this case, execute:

在这种情况下,执行:

brew link nvm