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
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!
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",
...
},
...
}
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
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With