安装
#先删除原有版本
apt-get remove nodejs npm -y --allow-remove-essential
#执行安装
curl -sL https://deb.nodesource.com/setup_12.x | bash -
#
apt-get install gcc g++ make -y --allow-remove-essential
#
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
#
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
#
apt-get update && apt-get install yarn -y --allow-remove-essential
配置
更改npm安装源
npm config set registry https://registry.npm.taobao.org