我尝试创建使用 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 证书?