yarn 出现error An unexpected error occurred错误的解决办法

  1. 使用yarn命令安装依赖,报错结果如下:
[17:42:29] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[17:42:29] [1/4] Resolving packages...
[17:42:29] error An unexpected error occurred: "https://registry.npm.taobao.org/ali-oss: certificate has expired".
[17:42:29] info If you think this is a bug, please open a bug report with the information provided in "/root/workspace/gem-gpt_Me5v/yarn-error.log".
[17:42:29] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[17:42:29] [ERROR] BUILD ERROR
[17:42:29] [ERROR] 183079825
[17:42:29] [ERROR] 1

则以下方法,可以解决

## 查看yarn的配置
yarn config list
 
## 让strict-ssl配置设置为false
yarn config set "strict-ssl" false -g
## 查看yarn的配置
yarn config list
 
## 让strict-ssl配置设置为false
yarn config set "strict-ssl" false -g
yarn install --force
yarn build:test

tee Dockerfile <<EOF
FROM gem-acr-p-a01-registry.cn-shenzhen.cr.aliyuncs.com/devops/tengine233:v1.0.1.0

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

ADD build /data/var/www/service/${K8S_APP_NAME}

# 暴露端口
EXPOSE 80 443

STOPSIGNAL SIGTERM

CMD ["nginx", "-g", "daemon off;"]


EOF