Getting Firebase not found error while deploying functions in firebase
Solution 1
Cannot find module 'firebase-functions' means that you need to install packages. In your project directory run
$ cd functions
$ npm install
then return back and fire!
$ firebase deploy
Happy coding!
Solution 2
By default, the firebase
dependency isn't in your functions/package.json
. Instead, you'll find it lists firebase-admin
, the specialized server-side Firebase SDK which is the one we recommend using.
If you really do want to use the firebase
client-side SDK instead of firebase-admin
, you'll want to run npm install --save firebase
in your functions/
directory. You should then have a line in your functions/package.json
that looks a bit like this:
{
...
"dependencies": {
"firebase": "^3.7.2",
...
},
...
}
Solution 3
Although this is coming late, but it's for those who might face the same issue. This worked for me. I added this to my package.json file in folder function.
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"firebase-admin": "~5.2.1",
"firebase-functions": "^0.6.2",
"mkdirp": "^0.5.1",
"mkdirp-promise": "^4.0.0"
},
"private": true
}
Then run: npm install in folder function
Solution 4
Clean up node_modules,
rm -rf package-lock.json
rm -rf node_modules
Update functions/package.json
file with latest or compatible versions of dependencies with your node version and run npm install
from functions folder.
Try firebase deploy
now. Should be good!
![Mohammed Rampurawala](https://i.stack.imgur.com/0v6DT.jpg?s=256&g=1)
Mohammed Rampurawala
Software Engineer working in Android and following the best practices. Having the hands-on experience on building the android apps which currently have 1 mn+ to 100 mn+ downloads. Worked on the medical-based IoT application. Currently working on the e-commerce platform.
Updated on June 15, 2022Comments
-
Mohammed Rampurawala about 2 years
I am trying to host a app in firebase and its giving me error that
Error: Error parsing triggers: Cannot find module 'firebase' Try running "npm install" in your functions directory before deploying.
I have executed
npm install
command several times but nothing new.Please help