前端安装依赖报错【certificate has expired】解决办法

报错信息:

yarn install v1.22.22
warning package.json: License should be a valid SPDX license expression
info No lockfile found.
warning [email protected]: License should be a valid SPDX license expression
[1/4] Resolving packages...
error Error: certificate has expired
    at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
    at TLSSocket.emit (node:events:519:28)
    at TLSSocket._finishInit (node:_tls_wrap:1085:8)
    at ssl.onhandshakedone (node:_tls_wrap:871:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

原因:

certificate has expired 错误通常是因为 npm 或 yarn 在尝试连接到 npm 注册表时遇到了 SSL 证书问题

解决办法

关闭证书验证

# npm关闭证书验证后再次安装依赖
npm config set strict-ssl false

# yarn 关闭证书验证

yarn config set strict-ssl false

你可能感兴趣的:(开发工具,前端,前端)