yarn global add json-server报错(npm i json-server -g报错)

作者 : admin 本文共639个字,预计阅读时间需要2分钟 发布时间: 2024-06-10 共3人阅读
yarn global v1.22.21
[1/4] Resolving packages...
error Error: certificate has expired
    at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._finishInit (node:_tls_wrap:953:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12)
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

这个问题是由于证书过期导致的。你可以尝试以下方法解决:
1、更新你的 Node.js 和 npm 到最新版本,然后重新安装 yarn。
2、使用 –no-verify-ssl 选项来跳过 SSL 证书验证。在命令行中输入以下命令:

yarn global add --no-verify-ssl -W -D v1.22.21

注意:这种方法可能会导致安全风险,因为它不验证SSL证书。在实际生产环境中,建议使用受信任的证书颁发机构颁发的证书

解决:yarn global add --no-verify-ssl -W -D v1.22.21,然后npm install -g json-serveryarn global add json-server安装即可

本站无任何商业行为
个人在线分享 » yarn global add json-server报错(npm i json-server -g报错)
E-->