Cannot find module 'firebase-admin/app'
See original GitHub issuepackage.json
requirements look like this –
"dependencies": {
"@sentry/node": "^5.30.0",
"body-parser": "1.19.0",
"express": "^4.17.1",
"firebase-admin": "10.0.0",
"mysql": "^2.18.1",
"pug": "3.0.2"
}
node_modules
has the corresponding module in the path ~/node_modules/firebase-admin/lib/app
Node code reads as –
const initializeApp = require('firebase-admin/app');
And when the app is run, the following stacktrace emerges.
Error: Cannot find module 'firebase-admin/app'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/html/project/backend/main.js:16:24)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:24
- Comments:37 (9 by maintainers)
Top Results From Across the Web
FIrebase deploy error: Cannot find module 'firebase-admin'
I went to the functions directory and ran yarn (or npm install if you are old-school). Then went back to my project directory...
Read more >Error: Cannot find module 'firebase-admin' - Google Groups
So I have new Firebase/Firestore project for Cloud Functions, and I have my index.js ... Detailed stack trace: Error: Cannot find module 'firebase-admin'....
Read more >firebase-admin - npm
Firebase provides the tools and infrastructure you need to develop your app, grow your user base, and earn money. The Firebase Admin Node.js...
Read more >Deploy fails with "Cannot find module 'firebase-admin' " even ...
I normally have a db.js function, which uses firebase-admin to read/write. Now when deploying (via git push) I keep getting deployment failures ...
Read more >Add the Firebase Admin SDK to your server - Google
Note: The Realtime Database API in the Go Admin SDK currently does not ... To use the module in your application, require it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved it by ignoring the import recommendation. Instead of
I am now using what existed before v10:
I started to use firebase-admin@^10.0.1 and I had this error when running jest tests. It couldn’t map “firebase-admin/app” to “firebase-admin/lib/app” as expected. So I have mapped this manually on jest.config.ts:
That worked for me.
And just to note, my tsconfig.json is like this: