找不到模块'@ google-cloud/logging'

Lee*_*eem 7 firebase google-cloud-functions

我是firebase函数的新手.在我的函数/ index.js中我定义了:

const Logging = require('@google-cloud/logging');
Run Code Online (Sandbox Code Playgroud)

当我运行firebase deploy --debug时,我经常遇到错误:

 Error parsing triggers: Cannot find module '@google-cloud/logging'
Run Code Online (Sandbox Code Playgroud)

为什么我得到这个错误???

(顺便说一下firebase init,我选择了Functions: 在此输入图像描述)

Dou*_*son 11

在将模块安装到项目中之前,它不能使用模块,它出现在package.json中.在您的functions文件夹中运行:

npm install @google-cloud/logging
Run Code Online (Sandbox Code Playgroud)