错误:解析触发器时出错:无法找到模块' firebase-functions'

时间:2018-01-16 10:38:46

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

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

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

我的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.

2 个答案:

答案 0 :(得分:4)

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

npm install -g firebase-functions

npm install --save-dev firebase-functions

npm install firebase-functions

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

答案 1 :(得分:0)

"dependencies": {
  "firebase-admin": "5.4.0",
  "firebase-functions": "0.7.0"
}

我已找到解决方案,我们即将升级依赖关系firebase-adminfirebase-functions,如下所示。