firebase函数错误:grpc_node.node是针对另一个Node.js编译的 [英] firebase functions error: grpc_node.node was compiled against a different Node.js

查看:103
本文介绍了firebase函数错误:grpc_node.node是针对另一个Node.js编译的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载并安装了较新的节点v8.9.4.

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

然后,我尝试使用以下命令在本地运行firebase函数:

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

firebase serve --only functions --debug

我收到以下节点js版本错误:

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)

====更新====

我同时尝试了npm rebuildnpm install,此后,我再次运行firebase serve --only functions --debug,但是仍然出现相同的错误.

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.

=====更新2 =====

我尝试删除它抱怨的模块:

I tried delete the module it complains about by:

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

然后运行:

npm install grpc

然后,再次运行firebase serve --only functions --debug,现在出现错误:

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???

推荐答案

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

这篇关于firebase函数错误:grpc_node.node是针对另一个Node.js编译的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆