Firebase功能部署错误

时间:2017-07-08 21:10:20

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

我很长一段时间都在研究这个项目。多次部署。 但是我在一个月左右的时间后打开了这个项目,并且在点击firebase部署之后我得到了以下错误 - 只有函数

i  deploying functions
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
✔  runtimeconfig: all necessary APIs are enabled
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: The module '/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/src/node/extension_binary/grpc_node.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

通用信息:

  

npm -v   5.1.0

     

node -v v8.1.3

我也尝试过LTS版本6.11.0,错误看起来有点不同但仍然是相同的。

i  deploying database, functions, hosting
✔  database: rules ready to deploy.
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
✔  runtimeconfig: all necessary APIs are enabled
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: Module version mismatch. Expected 48, got 51.
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_615356S6aA0PtZuOQ/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

试图进入

/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/

并运行

npm install --build-from-source

仍然是同样的错误。

我是否缺少重要的重建步骤?

2 个答案:

答案 0 :(得分:1)

解决了它。到目前为止,firebase-tools包似乎需要节点V 7.10.0。 通过nvm安装。

这只是一个临时修复。如果有人知道如何重建全局包的依赖关系,请发帖。

答案 1 :(得分:1)

根据Doug的建议,我重建了grpc:

npm rebuild grpc --update-binary

......错误消失了。你应该试一试。