Cannot find module 'actions-on-google' , working with dialogflow

I am using dialogflow fulfillment library for the very first time , here are the requirements

// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');

// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
var db = admin.initializeApp();
const { WebhookClient } = require('dialogflow-fulfillment');
process.env.DEBUG = "dialogflow:debug";

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((req, res) => {
    const _agent = new WebhookClient({ req, res });

    let params = req.body.queryResult.parameters;
    let actions = req.body.queryResult.action;
here is the package.json file

{
  "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"
  },
  "engines": {
    "node": "8"
  },
  "dependencies": {
    "actions-on-google": "^2.12.0",
    "firebase-admin": "^8.0.0",
    "firebase-functions": "^3.1.0"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.1.6"
  },
  "private": true
}

The error is Error: Error parsing triggers: Cannot find module 'actions-on-google' I've tried all the answer at this question .I just want to deploy my app at firebase

1 answer

  • answered 2019-09-22 02:42 Jawwad Turabi

    Just try to install an actions-on-google module in package.json inside the functions folder in your directory by using this command

    npm i actions-on-google --save
    

    This package is required because dialogflow provides integration with google assistant, so to make sure it works properly we have to install this package too.