我正在尝试在NodeJS应用程序中使用Google Cloud Vision。遵循client library example
console.log('started')
// Performs label detection on the image file
client
.labelDetection('./mydocument.jpg')
.then(results => {
console.log('checked')
const labels = results[0].labelAnnotations
console.log('Labels:')
labels.forEach(label => console.log(label.description))
}, err => {
console.error('ERROR:', err)
})
.catch(err => {
console.error('ERROR:', err)
})在控制台中只打印“已启动”。它不会进入success或failure函数。查看Google的仪表板,它显示正在使用的API (有一个实时图形,在我的nodejs应用程序运行时更新)。端点似乎没有返回任何内容,并且没有超时。但我在文档中找不到任何东西,堆栈溢出或GitHub问题。有什么线索吗?
发布于 2018-10-24 03:49:59
尝试使用版本0.22.1复制您的方案,但一切都很顺利:
npm install --save @google-cloud/visionconsole.log('started')行中的quickstart中提供的代码。

发布于 2018-07-28 03:42:59
你的第一个err => { console.log('ERROR:',err) }),.catch之前的那个不是本教程的一部分。试着移除它,看看它是否正常工作。
https://stackoverflow.com/questions/51563897
复制相似问题