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](https://www.cnblogs.com/dingshaohua/p/17103654.html "解决问题参考地址: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 //获取镜像源

相关推荐
天才奇男子14 小时前
HAProxy高级功能全解析
linux·运维·服务器·微服务·云原生
小李独爱秋14 小时前
“bootmgr is compressed”错误:根源、笔记本与台式机差异化解决方案深度指南
运维·stm32·单片机·嵌入式硬件·文件系统·电脑故障
学嵌入式的小杨同学14 小时前
【Linux 封神之路】信号编程全解析:从信号基础到 MP3 播放器实战(含核心 API 与避坑指南)
java·linux·c语言·开发语言·vscode·vim·ux
酥暮沐15 小时前
iscsi部署网络存储
linux·网络·存储·iscsi
❀͜͡傀儡师15 小时前
centos 7部署dns服务器
linux·服务器·centos·dns
Dying.Light15 小时前
Linux部署问题
linux·运维·服务器
S190115 小时前
Linux的常用指令
linux·运维·服务器
萤丰信息15 小时前
AI 筑基・生态共荣:智慧园区的价值重构与未来新途
大数据·运维·人工智能·科技·智慧城市·智慧园区
小义_16 小时前
【RH134知识点问答题】第7章 管理基本存储
linux·运维·服务器
运维小欣16 小时前
Agentic AI 与 Agentic Ops 驱动,智能运维迈向新高度
运维·人工智能