nvm是非常优秀的node版本管理工具。
本人在一个项目中计划生成gitbook,需要使用到node,于是乎安装个nvm。
对着github官方文档各种报错:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14926 100 14926 0 0 969 0 0:00:15 0:00:15 –:–:– 2174
=> Downloading nvm from git to ‘/root/.nvm’
=> Cloning into ‘/root/.nvm’…
fatal: unable to access ‘https://github.com/nvm-sh/nvm.git/’: Encountered end of file
Failed to clone nvm repo. Please report this!
一会儿无法下载:
fatal: unable to access ‘https://github.com/nvm-sh/nvm.git/’: Encountered end of file
Failed to clone nvm repo. Please report this!
一会儿又提示:
-bash: nvm: command not found
还有些提示git 版本升级的:
=> nvm is already installed in /root/.nvm, trying to update using git
=> => Compressing and cleaning up git repository
来,咱们解决这些问题:
- 无法下载,手动下载git版本;——问题解决;
- 解决后,使用同样的命令完成安装;—— 问题解决;
- git 版本不支持;——升级git版本,问题解决;
- 命令无法发现,解决办法如下:
echo “source ~/nvm/nvm.sh” >> ~/.bashrc
source ~/.bashrc
注意,目录与您的nvm安装目录相同。
14.5.0安装成功:
nvm install v14.5.0
Downloading and installing node v14.5.0…
Downloading https://nodejs.org/dist/v14.5.0/node-v14.5.0-linux-x64.tar.xz…
################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
manpath: can’t set the locale; make sure $LC_* and $LANG are correct
Now using node v14.5.0 (npm v6.14.5)
Creating default alias: default -> v14.5.0