安装Strapi出现错误certificate has expired

xiaohai 2024-06-13 14:51:26 1070人围观 标签: Node.js 
简介安装strapi出现错误:error Error: certificate has expired,TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')

最近在使用strapi过程中,在安装的时候容易出现两个错误
1、error Error: certificate has expired
image.png

产生原因:可能是开了服务器代理访问导致ssl安全证书失效

解决办法:在终端输入以下命令:

yarn config set "strict-ssl" false -g

2、TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')
出现这个错误是因为安装sharp和sharp-libvips没有安装成功,主要是因为yarn源的问题,解决方法:

在项目根目录下添加:.yarnrc文件,把下面内容复制进入:

registry "https://registry.npmmirror.com"
sass_binary_site "https://npmmirror.com/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npmmirror.com/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npmmirror.com/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npmmirror.com/dist/chromedriver"
sharp_binary_host "https://npmmirror.com/mirrors/sharp"
sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"