首页 > 解决方案 > 错误:AssistantV1.BaseService.initCredentials 的构造函数参数中提供的凭据不足

问题描述

我正在构建一个虚拟助手,它使用这个文档来响应触发词。

我按照教程进行操作,运行时npm start出现此错误。

C:\wat\node_modules\ibm-cloud-sdk-core\lib\base_service.js:307
            throw new Error(errorMessage);
            ^

Error: Insufficient credentials provided in constructor argument. Refer to the documentation for the required parameters. Common examples are username/password and iam_apikey.
at AssistantV1.BaseService.initCredentials (C:\wat\node_modules\ibm-cloud-sdk-core\lib\base_service.js:307:23)
at AssistantV1.BaseService (C:\wat\node_modules\ibm-cloud-sdk-core\lib\base_service.js:113:29)
at new AssistantV1 (C:\wat\node_modules\ibm-watson\assistant\v1.js:66:28)
at Object.<anonymous> (C:\wat\run.js:24:22)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chatbot-with-voice-activation-wake-word@1.0.0 start: `node ./run.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chatbot-with-voice-activation-wake-word@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\diana\AppData\Roaming\npm-cache\_logs\2019-09-    16T13_56_28_690Z-debug.log

我在文档中创建了三个文件:

我无法弄清楚它无法访问read-credentials-file存储为文件的.ts文件。

请帮我。提前致谢。

标签: ibm-watson

解决方案


我认为您必须检查您创建的文件“.env”,并确保您根据您的服务凭证更新了凭证。


推荐阅读