我们正尝试在https://github.com/openhab/openhab-google-assistant处实施报告状态API。
我们正在使用“ Google Actions”版本“ 2.6.0”。
我们在openhab.js文件中添加了以下几行
const {smarthome} = require('actions-on-google');
const app = smarthome({
});
请找到以下控制台输出。
smartfueb_march_gmail_com@instance-1-ubuntu16:/home/smartfueb_march/openhab-google-assistant/functions$ gcloud beta functions deploy openhabGoogleAssistant --stage-bucket smart_test1 --trigger-http
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: TypeError: smarthome is not a function
at Object. (/user_code/openhab.js:23:13)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/user_code/index.js:18:17)
at Module._compile (module.js:577:32)
答案 0 :(得分:0)
通过使用以下命令并将package.json文件更改为2.6.0,可以解决智能家居无法正常运行的问题。
$ sudo npm install -g actions-on-google @ latest