当我运行终端命令firebase deploy --only functions
时,经过一些处理后,我的终端会说:
Error parsing triggers: Cannot find module 'dialogflow-fulfillment'
Try running npm-install in your functions directory before deploying.
我在函数目录中运行了npm-install
,但是没有运气让它运行起来。
我在这里看到了类似的问题,并在package.json
中添加了依赖行,但我仍然遇到同样的错误。
我的index.js看起来像这样:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
//const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
我的package.json
看起来像这样
{
"name": "dialogflowFirebaseFulfillment",
"description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "~6.0"
},
"dependencies": {
"firebase-admin": "^5.12.0",
"firebase-functions": "^1.0.1",
"actions-on-google": "2.0.0-alpha.3",
"dialogflow": "^0.1.0",
"dialogflow-fulfillment": "0.3.0-beta.2"
},
答案 0 :(得分:1)
我遇到了同样的问题。问题出在我的package.json
上的package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.12.1",
"firebase-functions": "^1.0.3",
"dialogflow-fulfillment": "^0.4.1",
"actions-on-google": "^2.1.3"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
},
"private": true
}