TypeError: smarthome is not a function

TypeError: smarthome is not a function

我们正在尝试在 github openhab project 实施报告状态 API。

我们正在使用“actions-on-google”版本“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)

我们可以通过使用以下命令并将 package.json 文件更改为 2.6.0 来解决 smarthome 无法运行的问题。

$ sudo npm install -g actions-on-google@latest