安装 firebase 时出错`npm install -g firebase-tools`

error installing firebase `npm install -g firebase-tools`

我正在尝试将 firebase-cloud-messaging 与 javascipt

一起使用

我使用这个 repo:https://github.com/firebase/quickstart-js/tree/master/messaging

在入门中我必须 运行 这个命令 npm install -g firebase-tools。但是我得到了这样的错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protobufjs@6.11.2 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the protobufjs@6.11.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-10-28T09_18_46_217Z-debug.log

谁能帮我解释一下这是怎么回事,我已经尝试了 google 中的任何解决方案,但仍然出现这样的错误。 谢谢

版本节点:v14.18.1

版本 npm:6.14.15

OS : Linux 小学 6

尝试运行这个:

sudo npm install --unsafe-perm -g firebase-tools

有关 --unsafe-perm 的更多信息,请阅读 here