前因
今天在公司gitee拉取代码,准备装包的时候,一直报错 “An unexpected error occurred”
然后我尝试着切换科学上网工具,结果还是一直报错
折腾了半天,暗暗感觉应该是公司原因,导致不能正常访问
解决
在解决 “An unexpected error occurred” 错误之前,我们首先需要尝试清除软件包管理工具的缓存。对于使用 Yarn 进行依赖管理的项目,可以使用以下命令清除缓存:
yarn cache clean
yarn cache clean
npm和[yarn]转换淘宝源和官方源:
npm config set registry http://registry.npm.taobao.org/
npm config set registry https://registry.npmjs.org/
yarn config set registry http://registry.npm.taobao.org/
yarn config set registry https://registry.npmjs.org/
npm 设置代理
npm config set proxy http://127.0.0.1:8080
npm config set https-proxy http://127.0.0.1:8080
npm 删除代理
npm config delete proxy
npm config delete https-proxy
yarn 设置代理
yarn config set proxy http://127.0.0.1:8080
yarn config set https-proxy http://127.0.0.1:8080
yarn 删除代理
yarn config delete proxy
yarn config delete https-proxy