
解决npm代理 版本管理和某些模块无法下载的问题
版本管理使用nvm
代理设置
npm config set proxy=http://127.0.0.1:8087
npm config set https-proxy http://127.0.0.1:8087
// 需要用户名和密码
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
// 取消代理
npm config delete proxy
npm config delete https-proxy
npm 配置和安装设置
1. 查看镜像源
npm get registry
2. 切换官方源
npm config set registry http://www.npmjs.org
3. 切换淘宝源
npm config set registry http://registry.npm.taobao.org
4. 命令行临时使用指定镜像(淘宝)
npm --registry https://registry.npm.taobao.org install xxxxx
5. 命令行永久更改使用指定镜像(淘宝)
npm config set registry https://registry.npm.taobao.org
npm config set strict-ssl false // SSL错误(关闭SSL 证书校验)
npm config get registry // 查看当前源
npm config set registry https://registry.npmmirror.com/ // 设置淘宝源(已更新)
npm config set registry https://registry.npmjs.org/ // 设置官方源
npm config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
npm config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
npm config set electron_mirror https://registry.npmmirror.com/mirrors/electron/
yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
yarn config set electron_mirror https://registry.npmmirror.com/mirrors/electron/
yarn config set registry https://registry.npmmirror.com//
yarn config set registry https://registry.yarnpkg.com
yarn config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
yarn config set phantomjs_cdnurl http://cnpmjs.org/downloads
yarn config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/
yarn config set profiler_binary_host_mirror https://registry.npmmirror.com/mirrors/node-inspector/