【问题标题】:Error: Error parsing triggers: Cannot find module 'firebase-functions'错误:解析触发器时出错:找不到模块“firebase-functions”
【发布时间】:2018-01-16 10:38:46
【问题描述】:

每当我尝试与该消息相关的大多数解决方案时,都会遇到以下错误消息。请让我知道如何解决它。我刚刚克隆了https://github.com/davideast/hnpwa-firebase/ 的源并部署到我的firebase 帐户。

我已经在functions 文件夹中安装了npm install

我的 NodeJS 版本是 v7.0.0

i  deploying functions
i  functions: running predeploy script.

> functions@ build /Users/user/Documents/Projects/firebase/hnpwa-firebase/functions
> tslint -p tslint.json && ./node_modules/.bin/tsc

typeof-compare is deprecated. Starting from TypeScript 2.2 the compiler includes this check which makes this rule redundant.

WARNING: /Users/user/Documents/Projects/firebase/hnpwa-firebase/functions/src/index.ts[1, 13]: 'functions' is declared but its value is never read.

✔  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
✔  functions: all necessary APIs are enabled
i  functions: preparing dist/server directory for uploading...

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

Try running "npm install" in your functions directory before deploying.

【问题讨论】:

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


    【解决方案1】:

    尝试使用 -g 或 save-dev 参数进行安装。

    npm install -g firebase-functions
    
    npm install --save-dev firebase-functions
    
    npm install firebase-functions
    

    这几乎解决了我找不到模块的所有问题。 :D

    【讨论】:

    • 我已经在root 文件夹和functions 文件夹中进行了尝试。但它没有用。
    【解决方案2】:
    "dependencies": {
      "firebase-admin": "5.4.0",
      "firebase-functions": "0.7.0"
    }
    

    我找到了解决方案,我们即将升级两个依赖项 firebase-adminfirebase-functions,如下所示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 2019-06-12
      • 1970-01-01
      • 2017-11-03
      • 2020-10-11
      • 2020-03-19
      相关资源
      最近更新 更多