首页 > 解决方案 > Echo Show 10 上的 Alexa HTML Web API“Alexa.create not a function”错误

问题描述

这是我的 Alexa Skill 的 HTML 代码。

<head>
  <script src="https://cdn.html.games.alexa.a2z.com/alexa-html/latest/alexa-html.js"> 
  </script >
</head>
<body>
var alexaClient;
Alexa.create({version: '1.0'})
    .then((args) => {
        const {
            alexa,
            message
        } = args;
       alexaClient = alexa;
       document.getElementById('debugElement').innerHTML = 'Alexa is ready :)';
     })
     .catch(error => {
        document.getElementById('debugElement').innerHTML = 'Alexa not ready :(';
     });
</body>

在 Echo Show 8 和 Echo Show 5 上工作正常,但 Echo Show 10 对相同的代码给出错误。它说“Alexa.create 不是函数”。可能的错误是什么?

'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'0.2'}

这是 Echo Show 10 的请求 Echo Show 8 提供 1.1 版

这可能是问题吗?

标签: javascripthtmlalexaalexa-skills-kit

解决方案


在亚马逊文档中是这样的:

    "device": {
  "deviceId": "amzn1.ask.device.XXXX",
  "supportedInterfaces": {
    "Alexa.Presentation.HTML": {
      "runtime": {
        "maxVersion": "1.0"
      }
  },
    "Alexa.Presentation.APL": {
      "runtime": {
        "maxVersion": "1.4"
      }
    }
  }
}

maxVersion 为 1.0,因此它可能支持 create 功能,但 echo show 10 具有 maxVersion 0.2,因此它可能不支持或不具有 create 功能。我还不知道具体情况。

你能改变吗

'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'0.2'}

'Alexa.Presentation.HTML': {u'runtime': {u'maxVersion': u'1.0'}

? 假设您使用的是虚拟环境而不是真实设备。

您可能需要查看Alexa HTML SDK网站。


推荐阅读