gpt4 book ai didi

homestead - 使用 api 平台客户端生成器创建 vue.js 应用程序时出现 SSL 错误

转载 作者:行者123 更新时间:2023-12-05 07:18:45 27 4
gpt4 key购买 nike

我尝试为使用 API 平台创建的 API 创建客户端应用程序。我遵循本指南 https://api-platform.com/docs/client-generator/vuejs/ .

  • 我在开发 VM 时使用 Laravel Homestead。
  • 我已将 myapp .crt 文件添加到 Keychan Access。

问题是,当我尝试执行

generate-api-platform-client --generator vue https://myapp-api.local/api src/

它返回这样的错误信息:

{
api: Api { entrypoint: 'https://myapp-api.local/api', resources: [] },
error: FetchError: request to https://myapp-api.local/api failed, reason: unable to verify the first certificate
at ClientRequest.<anonymous> (/Users/permana.jayanta/.config/yarn/global/node_modules/node-fetch/index.js:133:11)
at ClientRequest.emit (events.js:209:13)
at TLSSocket.socketErrorListener (_http_client.js:406:9)
at TLSSocket.emit (events.js:209:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
name: 'FetchError',
message: 'request to https://myapp-api.local/api failed, reason: unable to verify the first certificate',
type: 'system',
errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
},
response: undefined,
status: undefined
}

我认为这与 SSL 证书有关。该节点无法识别该证书。如何让node.js识别Homestead生成的自定义SSL证书?

最佳答案

它无法验证 https 签名。要禁用它,请输入 shell

 export NODE_TLS_REJECT_UNAUTHORIZED=0

关于homestead - 使用 api 平台客户端生成器创建 vue.js 应用程序时出现 SSL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58169481/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com