尝试安装nvm

4

我想安装nvm,但一直遇到错误。

我运行了安装脚本:

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

但是出现了以下错误:

=> nvm is already installed in /Users/xxxxx/.nvm, trying to update using git
=> => Compressing and cleaning up git repository

=> nvm source string already in /Users/xxxxx/.bash_profile
=> bash_completion source string already in /Users/xxxxx/.bash_profile
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/Users/xxxxx/.nvm/versions/node/v10.17.0/lib
└── yarn@1.22.4
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm or run the following to use it now:

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

如果我关闭并打开新的终端窗口,并使用 nvm -v 命令检查 nvm 的版本号,会得到以下结果:

zsh: 找不到命令:nvm

1个回答

2

Mac OS修复

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

之后关闭终端并重新打开。

嗨喵,现在应该可以完美地工作了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接