Node npm 环境配置

123 阅读1分钟

资源地址

MAC 安装命令

使用 brew 安装

# 安装指定版本的 node
brew install node@20

使用 nvm 安装

# 安装 nvm, 已安装的跳过此步骤
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

# 安装指定版本的 node
nvm install 20

npm 切换镜像地址命令

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

npm 常见命令

# 查看版本
node -v
npm -v

# 安装包
npm install package-name

# 全局安装包
npm install -g package-name

# 卸载包
npm uninstall package-name

# 更新包
npm update package-name

# 更新所有依赖包
npm update

# 查看已安装的包
npm list

稳定版本

Node(LTS)NPM
v20.17.010.8.2
v18.20.410.7.0