繁体   English   中英

找不到模块:导入 firebase-admin 时无法解析“http2”

[英]Module Not Found: Can't resolve 'http2' when importing firebase-admin

        Failed to compile
    ./node_modules/@grpc/grpc-js/build/src/channel.js
    Module not found: Can't resolve 'http2' in '/Users/Michael/Development/Projects/mpsa-ntcs/node_modules/@grpc/grpc-js/build/src'

This error occurred during the build time and cannot be dismissed.

将 firebase-admin 导入我的应用程序时,我不断收到此错误。 我尝试更新 GRPC,尝试降级/升级节点,重新安装节点 + npm ... 一切!

有人知道这方面的任何解决方法吗?

谢谢!

我相信您需要安装已弃用的“http2”包。 尝试运行:

npm install http2

我已经改用纱线了。 删除 yarn remove firebase-admin 再次安装 yarn add firebase yarn add firebase-admin yarn add http2 我的代码可以工作。 我认为 yarn 比 npm 好。

注意:节点版本 9.0.0 支持 http。 我的节点版本是 13。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM