Leo
Leo

Reputation: 4438

After Firebase deploy - Error: cannot find module

Running a Node.js function in the local Firebase server does not result in the error below, but when I do firebase deploy and try to run the same function on the deployed server I get this error in the Firebase Functions log (in the web Firebase console):

Error: Cannot find module '@google-cloud/speech'

What have I missed? (I can run some other functions on the deployed server, but I am new to this and have no idea if I have done something different, or if there is something different about this npm module.)

Upvotes: 1

Views: 1508

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317828

Cloud Functions will only install the modules that you've declared as dependencies in your package.json (and their dependencies) in the functions folder. If the module doesn't show up there, you won't be able to access it directly from your code. Be sure to run @google-cloud/speech from your functions folder, so that you can use it both during development an when deployed.

Upvotes: 1

Related Questions