When I run
Error parsing triggers: Cannot find module 'firebase-admin'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
"description": "Cloud Functions for Firebase",
npm install firebase-admin
npm install --save firebase-admin
npm ERR! Cannot read property '0' of undefined
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.