nodejsにMicrosoft Cognitive Services apiを使用しています。私はこのコード私は、次の取得エラーTypeError:cognitiveServices.faceがコンストラクタではありません
const face = new cognitiveServices.face({
^
TypeError: cognitiveServices.face is not a constructor
at Object.<anonymous> (/Users/..../face.js:3:14)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
がどのように私はこのエラーを解決することができます実行したとき、私は、コードが
const cognitiveServices = require('cognitive-services');
const face = new cognitiveServices.face({
API_KEY: yourApiKey
})
const parameters = {
returnFaceId: "true"
returnFaceLandmarks: "false"
};
const body = {
"url": "URL of input image"
};
face.detect({
parameters,
body
})
.then((response) => {
console.log('Got response', response);
})
.catch((err) => {
console.error('Encountered error making request:', err);
});
次がありますか?
は、あなたは正しい、そのモジュールの上部にある文を必要としていますか?その声明を含めるためにあなたの質問を編集できますか?同様に、https://github.com/joshbalfour/node-cognitive-services#installationで、インストールとスタートアップの手順に従って認知サービスAPIを正しくインストールしたことを確認するとよいでしょう。 – ArthurDenture
はい私はそれを持っており、私は質問を更新しました。 – 2619
こんにちは、私の答えはあなたのために働いたのですか?私は賞金がまだ開いているのを見る... – ArthurDenture