node.js - 通过 webhook 将 Google Home 连接到 node.js

标签 node.js dialogflow-es

我正在关注这篇文章:

https://medium.com/google-cloud/how-to-create-a-custom-private-google-home-action-260e2c512fc

当我在 Mac 上的文件夹中运行 npm start 进行测试时,我得到了这个:

Marcios-MacBook-Pro:webhook mars$ npm start

> your-action-app@0.0.1 start /Users/mars/Downloads/webhook
> functions deploy yourAction --trigger-http

sh: functions: command not found

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/7.8.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! your-action-app@0.0.1 start: `functions deploy yourAction --trigger-http`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the your-action-app@0.0.1 start script 'functions deploy yourAction --trigger-http'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the your-action-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     functions deploy yourAction --trigger-http
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs your-action-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls your-action-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mars/.npm/_logs/2017-04-12T14_32_03_870Z-debug.log

我在 Api.ai 中创建了操作,并将 package.json 修改为:

{
  "name": "execute-home-command",
  "description": "This is your Action's webhook",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "~6.0"
  },
  "scripts": {
    "lint": "semistandard --fix \"**/*.js\"",
    "start": "functions deploy execute-home-command --trigger-http",
    "deploy": "gcloud beta functions deploy execute-home-command --trigger-http --stage-bucket <storage_bucket_name>"
  },
  "dependencies": {
    "actions-on-google": "^1.0.0"
  },
  "devDependencies": {
    "semistandard": "^9.1.0"
  }
}

这是操作:

api.ai

最佳答案

我猜你没有 functions-emulator 的 npm 包已安装。

尝试通过npm install -g @google-cloud/functions-emulator安装它

关于node.js - 通过 webhook 将 Google Home 连接到 node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43377268/

相关文章:

node.js - Nodejs : managing distributed transactions like java ee

javascript - 如何正确处理 Promise.all : Getting undefined

Node.js 模块 "fibers"没有采用正确的版本

dialogflow-es - 对 Google 的操作返回模拟器 "We' 很抱歉,但出了点问题。请再试一次。”

firebase - Api.ai 是否可以使用 Firebase 以外的服务?如果可以,有哪些示例?

javascript - 带promise的导出函数,等待响应

dialogflow-es - 连接一个网络服务,它可以询问问题并接收答案?

javascript - DialogFlow 中的 fulfillmentText 与 fulfillmentMessages

javascript - Node js 代码中必须有多少 connection.release() ?

node.js - Dialogflow - 编码履行时处理用户差异