我遵循入门的IBMCloud Visual Recognition页面:https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-getting-started-tutorial&programming_language=javascript#getting-started-tutorial。
显示以下代码:
var VisualRecognitionV3 = require('watson-developer-cloud/visual-recognition/v3');
var fs = require('fs');
var visualRecognition = new VisualRecognitionV3 ({
version: '2018-03-19', iam_apikey: '{apikey}'
});
var url= 'https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/640px-IBM_VGA_90X8941_on_PS55.jpg';
var params = {
url: url,
};
visualRecognition.classify (params, function (err, response) {
if (err) {
console.log(err);
} else {
console.log(JSON.stringify(response, null, 2))
}
});
在Windows上通过节点执行它时,出现以下错误消息:
error: { Error: Response not received. Body of error is HTTP ClientReque
t
at formatError (C:\Users\augusto\node_modules\ibm-cloud-sdk-c
requestwrapper.js:111:17)
at C:\Users\augusto\node_modules\ibm-cloud-sdk-core\lib\reque
r.js:259:19
at process._tickCallback (internal/process/next_tick.js:68:7)
message:
'Response not received. Body of error is HTTP ClientRequest object',
我已经像教程一样安装了,我也不知道错误在哪里。
答案 0 :(得分:0)
已解决:
const visualRecognition = new VisualRecognitionV3({
version: '{version}',
iam_apikey: '{apikey}'
disable_ssl_verification: true,
});