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 //获取镜像源

相关推荐
至此流年莫相忘5 分钟前
WSL2 下 Docker Desktop 完全配置指南:从安装到极速体验
运维·docker·容器
烂白菜5 分钟前
码道启辰:定时任务自由编排
运维·服务器·网络
悠悠1213817 分钟前
Linux 7.1 来了:新 NTFS 驱动、干掉 i486、FRED 默认开启,这次更新有点东西
linux·运维·服务器
by————组态18 分钟前
Ricon组态组件生态 - 丰富的可视化组件库
运维·前端·物联网·组态·组态软件
格发许可优化管理系统18 分钟前
Mentor许可证与其他软件许可证的深度比较
java·大数据·运维·c语言·c++·算法
睡不醒男孩03082322 分钟前
CLup篇之达梦数据库管理
运维·服务器·数据库
用户8055336980323 分钟前
Linux 工作队列:把中断里做不了的事推迟到进程上下文
linux·嵌入式
BomanGe324 分钟前
NSK直线导轨LH20HL替代升级指南
运维·服务器·数据库·经验分享·规格说明书
pingglala27 分钟前
winscp连接linux失败解决方法
java·linux·服务器
William.csj30 分钟前
Linux——普通用户离线源码编译 gcc-9 方法和调用教程
linux·服务器·gcc