赞
踩
# 使用清华大学 Ubuntu 软件镜像
sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
apt update
# 安装npm
apt install npm
# 验证安装
npm -version
# 更换淘宝源
npm config set registry https://registry.npm.taobao.org
# 验证源是否更换成功
npm config get registry
# 在全局安装n模块,用n模块管理nodejs
npm install -g n
# 下载指定版本的nodejs
n v14.19.0
# 刷新bash, zsh, ash, dash, ksh
hash -r
# 如果用的是tcsh请使用下面的命令
# rehash
# 验证安装
node -v
(1)安装步骤
# 安装yarn
npm install -g yarn
# 验证安装
yarn --version
# 更换淘宝源
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
(2)常用yarn命令
传送门,Biu~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。