我在windows计算机上出错,但在同一网络上的mac电脑上没有。有什么想法吗?
(node:16940) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at E:\xxx.js:28:47
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16940) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id:
2)
(node:16940) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
function checkNumSatoshis(JWTToken, qrcode) {
return new Promise((resolve, reject) => {
axios.get(
`http://xxx.local/api/v1/xx/xx/invoice?paymentRequest=${qrcode}`,
{
headers: {
Authorization: `JWT ${JWTToken}`,
},
}
)
.then((res) => resolve(res.data.xx))
.catch((error) => reject(error.response.data))
});
}
2条答案
按热度按时间uidvcgyl1#
将192.168.1.x xx.local添加到c:\windows\system32\drivers\etc\hosts中。我在主机文件中输入了正确的格式
mwg9r5ms2#
设置请求时出错,因此承诺转到catch块。然而,
error.response
是undefined
因为没有提出任何要求。改为执行以下操作以获取有关此错误的更多信息: