Khush
Khush

Reputation: 877

Cannot find module 'dialogflow-fulfillment'

When I run the terminal command firebase deploy --only functions, after a bit of processing my terminal will say:

Error parsing triggers: Cannot find module 'dialogflow-fulfillment'
Try running npm-install in your functions directory before deploying.

I have run npm-install in the functions directory, but have had no luck in getting this to work.

I saw a similar question up here and added the dependancy line in my package.json, but I am still getting the same error.

My index.js looks like this:

'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

and my package.json looks like this

{
  "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"
  },

Upvotes: 1

Views: 3547

Answers (1)

Aarth Tandel
Aarth Tandel

Reputation: 1009

I faced the same issue. The problem was with my 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
}

Upvotes: 1

Related Questions