推荐用版本管理工具 nvm 来管理 Node.js
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ source ~/.bashrc之后用 nvm 安装并管理 Node.js
$ nvm install <version>
$ npm i -g yarn
$ node -v
$ npm -v$ npm config list# 1 直接修改
$ npm config set registry https://registry.npm.taobao.org
$ yarn config set registry https://registry.npm.taobao.org
# 2 通过编辑配置文件
$ vi ~/.npmrc
# 添加或者修改 registry 地址
registry=https://registry.npm.taobao.org/