3

I was going through google's tutorial for their action, while trying to make some modifications to suit what I was trying to do. When I run the terminal command 'firebase deploy', after a bit of processing my terminal will say: "Error parsing triggers: Cannot find module 'actions-on-google'. 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.

Here is the top bit of code in my index.js file:

'use strict';

process.env.DEBUG = 'actions-on-google:*';
const {DialogflowApp} = require('actions-on-google');
const functions = require('firebase-functions');

exports.echoNumber = functions.https.onRequest((req, res) => {
  const app = new DialogflowApp({request: req, response: res});
Thomas
  • 35
  • 2
  • 8

5 Answers5

10

You should have a package.json file in that directory. It should have a dependencies section. And in that section there should be a line for every package that you require().

In particular

"actions-on-google": "^1.8.0",

William DePalo
  • 615
  • 4
  • 8
2

When this happened to me it was because I was trying to run the command from the base directory instead of the functions directory.

NathanH
  • 154
  • 1
  • 10
1

Please try the below command in your Project/functions directory before deploy

npm install firebase-admin@5.5.0

npm install

It will work properly

Sudhakar
  • 533
  • 1
  • 3
  • 17
0

After exhausting the other answers, this worked for me

  1. Delete the functions/node_modules folder
  2. Using command prompt run npm install on the functions folder

My best guess is a corrupted functions/node_modules/actions-on-google folder

Marcello B.
  • 4,177
  • 11
  • 45
  • 65
0

Try to run the commands following in sequence:

  1. npm install action on google
  2. npm install

This worked for me might be useful for you too.

mshomali
  • 664
  • 1
  • 8
  • 27