在使用npm安装项目时,默认源在国外,导致速度贼慢甚至安装失败,这时可以通过以下命令修改源:

npm --registry https://registry.npm.taobao.org install xxx
npm config set registry https://registry.npm.taobao.org

通过以下命令查看是否修改成功:

npm config get registry