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

相关推荐
IMPYLH6 分钟前
Linux 运维基础:从入门到实战的完整指南
linux·运维·php
前端 贾公子13 分钟前
LangGraph == 图的状态(State)管理 (下)
运维·服务器·数据库
Lsetea14 分钟前
curl走HTTPS代理报SSL证书错误:proxy-cacert与cacert双层信任排查
linux·https·ssl证书·curl·代理服务器
星恒随风17 分钟前
Linux进程间通信(二):深入理解System V共享内存、消息队列、信号量与内核IPC资源管理
linux·运维·服务器·笔记·学习·状态模式
yangmu320326 分钟前
PLC 设备介绍:工业自动化的“控制大脑”
运维·自动化
IMPYLH32 分钟前
Linux 文件检索:find、locate、grep 与 which 实战指南
linux·运维·服务器
腾讯蓝鲸智云39 分钟前
【运维自动化-监控平台】如何配置进程监控之基于进程名规则匹配
运维·自动化·云计算·sass·paas
优化Henry41 分钟前
LTE基站传输割接后S1连接失败排查实录
运维·网络·笔记·学习·信息与通信
西索斯coding43 分钟前
Claude Code 工具调用返回空怎么办?claude-opus-5.5 的 input_schema 校验踩坑记录与修复方案
服务器·前端·javascript·ai
流烟默1 小时前
ClickHouse Part 机制与写入优化实践指南
大数据·运维·clickhouse