gpt4 book ai didi

python - 无法在 MacOS : 'zsh: command not found: nvm' 上使用 nvm install

转载 作者:行者123 更新时间:2023-12-04 13:37:18 28 4
gpt4 key购买 nike

我很感激这个问题已被问过几次,但没有一个答案能够帮助我。

我是在终端工作的新手,正在尝试在 MacOS Catalina 上使用 nvm 安装 Node 。我使用“brew install nvm”成功安装了 nvm,但是当我尝试运行“nvm install 10.15.0”时出现错误“zsh: command not found: nvm”。

运行 'brew info nvm' 给了我这个:

You should create NVM's working directory if it doesn't exist:

mkdir ~/.nvm

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

export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

所以,我遵循了这些说明;我创建了 NVM 工作目录并将配置添加到我的/.bash_profile shell。这是使用“nano .bash_profile”运行时的 .bash_profile 文件:
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/emilybradley/opt/anaconda3/b$
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/emilybradley/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/emilybradley/opt/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/emilybradley/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<


# virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source "$(pyenv which virtualenvwrapper.sh)"

# RabbitMQ
export PATH=/usr/local/sbin:$PATH

export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

我已经重新启动了终端,但 nvm install 仍然不起作用。老实说,我对 .bash_profile 文件有点困惑,想知道它是否与 PATH 有关?

最佳答案

这个问题已经回答过很多次了。
最近的这个问题对通过 brew 安装 nvm 有一个简单而直接的答案:
simple solution
如果您使用或不使用 brew 进行安装,这个较旧的问题有更深入的解决方案和其他详细信息:
detailed solutions

关于python - 无法在 MacOS : 'zsh: command not found: nvm' 上使用 nvm install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61087372/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com