firebase functions error: grpc_node.node was compiled against a different Node.js

核能气质少年 提交于 2019-12-13 08:21:24

问题


I just downloaded and installed a newer node v8.9.4.

Then, I try to run firebase functions locally with command:

firebase serve --only functions --debug

I get the following node js version error:

functions: Cannot start emulator. Error: The module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/grpc_node.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. 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`).

How can I get rid of this error (I would like to use latest node version)

==== UPDATE ====

I tried both npm rebuild and npm install, after that, I run firebase serve --only functions --debug again, but I still get the same error.

===== UPDATE 2 =====

I tried delete the module it complains about by:

rm -rf /usr/local/lib/node_modules/firebase-tools/node_modules/grpc/

Then, run:

npm install grpc

Then, run firebase serve --only functions --debug again, now I get error:

⚠  functions: Cannot start emulator. Error: Cannot find module 'grpc'

Seems it doesn't do what I wished, what should I do now to get rid of this new error???


回答1:


Solved by sudo npm install -g grpc --allow-root --unsafe



来源:https://stackoverflow.com/questions/48492104/firebase-functions-error-grpc-node-node-was-compiled-against-a-different-node-j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!