nvm for windows C++ nvm

mowen 2024-10-07 64

https://github.com/coreybutler/nvm-windows/releases


查看版本

nvm -v


设置环境变量

NVM_HOME=xxx\nvm
NVM_SYMLINK=xxx\nodejs
PATH=%PATH%;%NVM_HOME%;%NVM_SYMLINK%


设置镜像

nvm node_mirror https://npmmirror.com/mirrors/node/
nvm npm_mirror https://npmmirror.com/mirrors/npm/


nodejs版本列表


nvm常用命令

# 开启/关闭nodejs版本管理
nvm on
nvm off

# 显示node是运行在32位还是64位
nvm arch

# 安装nodejs
nvm install 20
nvm install 20.16.0

# 卸载nodejs
nvm uninstall 20.16.0

# 查看已安装nodejs版本
nvm list

# 切换nodejs版本
nvm use 14.21.3

# 查看当前正在使用nodejs版本
nvm current

# 给指定nodejs版本创建别名
nvm alias <name> <version>

# 在指定版本下运行脚本
nvm run <version> <script>


npm设置安装路径、全局缓存

npm config set prefix "xxx\nvm\npm\node_global"
npm config set cache "xxx\nvm\npm\node_cache"


npm查看安装路径、全局缓存、全局npm包路径、设置镜像、查看配置

npm get prefix
npm get cache
npm root -g
npm list -g --depth=0
npm config set registry https://registry.npmmirror.com
npm config list


将prefix目录加到系统环境变量Path里

PATH=%PATH%;xxx\nvm\npm\node_global


npm安装yarn

npm install -g yarn


yarn设置代理(可选)

yarn config set proxy http://localhost:10809
yarn config set https-proxy http://localhost:10809


yarn设置镜像(推荐)

yarn config set registry https://registry.npmmirror.com


yarn查看配置

yarn config list


最新回复 (0)
返回
发新帖
X