gpt4 book ai didi

Node.js 崩溃/退出,在缩小的 npm 包中没有任何错误消息,如何调试?

转载 作者:太空宇宙 更新时间:2023-11-03 22:04:16 26 4
gpt4 key购买 nike

我正在使用库 google-trends-api,由于某种原因,它导致 Node 退出而没有任何错误。只是一个干净无误的退出。 try/catch 被忽略。我很困惑,因为在我使用 Node 的 3 年里从未发生过这种情况。

这是代码,但这并不重要:

  let res
try {
res = await googleTrends.interestOverTime({
keyword: ['something', keyword],
geo: 'EN',
startTime: new Date(getDaysAgoTimestamps(365)),
agent: proxyAgent
})
debug({res})
res = JSON.parse(res)
}
catch (e) {
debug('getTrendsAverages error')
debug(e)
}

我的问题是,我怎样才能开始调试它?我尝试查看 Node 模块中的库,但它已缩小。

最佳答案

尝试添加以下错误处理函数,因为它们将提供有关您的问题的更多详细信息。


process.on('unhandledRejection', (reason, promise) => {
console.log(reason)
})
process.on('uncaughtException', (reason) => {
console.log(reason)
})

关于Node.js 崩溃/退出,在缩小的 npm 包中没有任何错误消息,如何调试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58809677/

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