linux install nvm

官网地址:https://github.com/nvm-sh/nvm

1、wget https://codeload.github.com/nvm-sh/nvm/tar.gz/refs/tags/v0.39.7

tar -zxvf v0.39.7

2、vim ~/.bashrc

$HOME=root

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

nodejs下载更换淘宝镜像

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node

export NVM_NODEJS_ORG_MIRROR=https://registry.npm.taobao.org

3、nvm --version

nvm current 查看当前node版本

nvm install v16

nvm uninstall v16 移除安装node

nvm ls 查看已安装node

nvm ls-remote 查看目前线上可安装 node

4、高版本node无法使用问题:

查看系统内安装的glibc版本

然后再根据分析可得知 新版的node v18开始 都需要GLIBC_2.27支持,可是目前系统内却没有那么高的版本

strings /lib64/libc.so.6 |grep GLIBC

解决问题参考地址:https://www.cnblogs.com/dingshaohua/p/17103654.html

npm config set registry=https://registry.npmmirror.com

//执行以下命令查看是否配置成功

npm config get registry

npm install -g yarn

#更改淘宝镜像

yarn config set registry https://registry.npm.taobao.org

yarn config set registry https://registry.npm.taobao.org -g

yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

yarn init // 生成package.json文件

yarn install // 安装yarn.lock的所有依赖

yarn install --force // 重新安装依赖

yarn remove moduleName // 删除依赖

yarn add moduleName // 安装某个依赖

yarn add moduleName --dev/-D // 安装到开发环境

yarn run scriptName // 执行package.json命名的脚本命令

yarn config get registry //获取镜像源

相关推荐
likfishdn12 分钟前
Linux的文件与目录管理
linux·运维·服务器
渲染101专业云渲染14 分钟前
川翔云电脑优势总结
服务器·3d·电脑·blender·maya
chian-ocean32 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=34 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
橘子味的茶二43 分钟前
高级系统架构师--第十章:计算机网络
服务器·计算机网络·系统架构
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
紫菜(Nori)1 小时前
短连接服务器压测-wrk
服务器·压力测试
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos