Thomas David Kehoe Thomas David Kehoe - 5 months ago 89
Node.js Question

Cloud Functions for Firebase firebase deploy error: "Error parsing triggers: Cannot find module 'firebase-admin'"

When I run

firebase deploy
I get this error:

Error parsing triggers: Cannot find module 'firebase-admin'

Here's my code:

const functions = require('firebase-functions');

const admin = require('firebase-admin');


"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"firebase-admin": "^5.2.1",
"firebase-functions": "^0.6.2",
"request": "^2.83.0"
"private": true

Here are my global node modules:

npm list -g --depth=0
├── child_process@1.0.2
├── firebase-admin@5.3.0
├── firebase-tools@3.12.0
├── fs@0.0.2
├── npm@5.4.2
└── request@2.83.0

I don't have
installed locally:
enter image description here

npm install
npm install firebase-admin
, and
npm install --save firebase-admin
in the local
directory return this error message:

npm ERR! Cannot read property '0' of undefined

I'm using npm version 5.4.2.

I changed

I removed
but that didn't fix the problem.

I get the same error message when I do this in the project root directory and in the

Any suggestions?

Answer Source

What worked was to make a fresh directory and set up the "Hello world" tutorial from the Firebase documentation. This creates a node_modules directory that includes firebase-admin. I then swapped the new node_modules directory with the old directory and it worked.

The problem appears to have been that I had firebase-admin installed globally so npm install wouldn't install it locally in my functions directory, but firebase deploy can't find global Node modules, it has to have local Node modules. That's my guess.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download