nvm
官网
https://github.com/nvm-sh/nvm
容易成功的方式
If you have git
installed (requires git v1.7.10+):
- clone this repo in the root of your user profile
cd ~/
from anywhere thengit clone https://github.com/nvm-sh/nvm.git .nvm
cd ~/.nvm
and check out the latest version withgit checkout v0.40.1
或者git chechkout v0.39.3
等- activate
nvm
by sourcing it from your shell:./nvm.sh
或者install.sh
完成之后执行source ~/.bashrc
才能生效
nvm安装命令
# 同时完成node和npm的安装
nvm install 14.7.0
安装完npm之后,最好添加npm的国内源,例如:
npm config set registry https://npm.aliyun.com/
参考:https://cloud.tencent.com/developer/article/2483466
pnpm的安装
完成nvm的安装之后,很容易通过nvm install 安装 node 和 npm,
安装完npm之后,很容易进行pnpm的安装
普通命令
npm install -g pnpm
卸载命令
npm uninstall -g pnpm
特定版本安装
npm install -g pnpm@x.x.x
yarn安装
npm install --global yarn
# 验证
yarn --version
总结
nvm->node and npm ->pnpm and npm ->yarn
文档信息
- 本文作者:Chaojie Men
- 本文链接:https://menchaojie.github.io/2024/10/28/nvm-related/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)