当我执行$ firebase deploy命令时,出现此错误?

时间:2018-11-07 07:01:17

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

  

我想创建一个http函数,以使用Firebase云功能将图像上传到Firebase存储。

package.json

"dependencies": {
    "@google-cloud/storage": "^2.3.0",
    "busboy": "^0.2.14",
    "cors": "^2.8.5",
    "firebase-admin": "^6.1.0",
    "firebase-functions": "^2.1.0",
    "uuid": "^3.3.2"
  }

错误

Error: Error occurred while parsing your function triggers.
TypeError: require(...) is not a function
at Object.<anonymous> (/home/a7me63azza8/Desktop/flutter/flutter_course/functions/index.js:21:45)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)    at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /usr/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/usr/lib/node_modules/firebase- 
tools/lib/triggerParser.js:53:3)

错误屏幕截图 enter image description here

1 个答案:

答案 0 :(得分:1)

我也在做udemy flutter课程,并且有一个文档要求您安装1.7版的@ google-cloud / storage。

这对我有用,运行:

npm install --save @ google-cloud / storage @ 1.7

然后运行:firebase部署