'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.
I keep getting this error when importing firebase-admin to my app. I tried updating GRPC, tried downgrading/upgrading node, reinstalled node + npm... everything!!
Anyone know any workarounds for this?
Thanks!
Solution 1:[1]
I believe you need to install the deprecated 'http2' package. Try running:
npm install http2
Solution 2:[2]
I have changed to use yarn. Remove yarn remove firebase-admin Install again yarn add firebase yarn add firebase-admin yarn add http2 And my code can work. I think yarn is better than npm.
Note: http is supported from node version 9.0.0. My Node version is 13.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Brandon |
Solution 2 | Kyle Nguyen |