【问题标题】:Cannot find module 'firebase-functions'找不到模块'firebase-functions'
【发布时间】:2020-08-12 17:44:34
【问题描述】:
cosnt functions = require(firebase-functions);
exports.sayHello = functions.http.onCall((data,context) =>{
return 'Hey there :D";
})

我有上面的代码,非常基本,只是想将它部署到 Firebase Cloud Functions。 我正在运行最新版本的 Node,并且已经完成了 npm install -g firebase-toolsfirebase init,然后是 firebase deploy --only functions。 但是,我一直在不断得到结果

Cannot find module 'firebase-functions' 

不用说,代码无法部署。 我该如何克服这个问题?

【问题讨论】:

    标签: javascript node.js firebase google-cloud-functions


    【解决方案1】:

    您可能告诉 CLI 最后不要安装依赖项。您必须从函数文件夹中运行 npm install 才能安装所需的依赖项。

    如果您想使用 Firebase CLI 使用 Cloud Functions,最好了解 package.json 的工作原理,以及如何使用 npm 处理 nodejs 依赖项。

    【讨论】:

    • 我多次按照 CLI 的指示进行了 npm install,希望问题能够自行解决。它根本没有工作
    猜你喜欢
    • 1970-01-01
    • 2017-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-22
    • 2019-03-10
    • 2018-05-16
    • 1970-01-01
    相关资源
    最近更新 更多