自制软件安装了nvm,但之后找不到nvm? [英] Homebrew installs nvm but nvm can't be found afterwards?
问题描述
我在新安装的OSX 10.10.1上使用homebrew
和oh-my-zsh
.我通过homebrew
获得了nvm
,然后尝试运行它,但是却说- zsh:找不到命令:nvm
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
任何想法是什么问题?我能够很好地安装和使用git ...
Any idea what the problem is? I was able to install and use git just fine...
更新9/20/2019
如 DarkPurple141 和此处中的官方nvm-sh存储库中也对此进行了说明. /p>
As stated by more recent answers from DarkPurple141 and Elise van Looij. nvm
doesn't appear to be compatible with homebrew
. This is also stated in the official nvm-sh repo located here.
不支持自制程序安装.如果您有任何问题 自制安装的nvm,请brew卸载它,然后使用 提交问题之前,请按照以下说明进行操作.
Homebrew installation is not supported. If you have issues with homebrew-installed nvm, please brew uninstall it, and install it using the instructions below, before filing an issue.
注意:如果您使用的是zsh,则可以轻松地将nvm安装为zsh插件. 安装zsh-nvm并运行nvm upgrade进行升级.
Note: If you're using zsh you can easily install nvm as a zsh plugin. Install zsh-nvm and run nvm upgrade to upgrade.
以下步骤应有所帮助:
- $
brew uninstall nvm
- $
brew cleanup
(仅作参考) - $
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
-
通过运行$
command -v nvm
检查nvm是否正确安装.
- $
brew uninstall nvm
- $
brew cleanup
(just for good measure) - $
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Check that nvm was installed correctly by running $
command -v nvm
.
4.a如果响应不是$ nvm
以外的任何其他内容,请在〜/.bash-profile文件中添加以下两行:
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
4.b重新启动计算机(您可以尝试关闭终端并先重新启动)
4.c $ command -v nvm should now return
nvm`
4.a If the response is anything other than $ nvm
, add the following two lines to the ~/.bash-profile file:
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
4.b Restart your computer (you can try closing Terminal and restarting it first)
4.c $ command -v nvm should now return
nvm`
现在使用$ nvm install --lts
推荐答案
您是否遵循了警告中列出的说明?
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
没有额外的配置,默认情况下它不会找到NVM.
Without the extra config it doesn't look like it will find NVM by default..
这篇关于自制软件安装了nvm,但之后找不到nvm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!