Reputation: 3112
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
Upvotes: 33
Views: 25198
Reputation: 11
In my case, some of the cached packages were installed with root permission. So when I tried to deploy with only npm run deploy
, was not finding the packages.
sudo npm run deploy
worked for me.
Upvotes: 1
Reputation: 11
first you have to select command prompt terminal instead of power shell ,then install npm within functions then run command npm start .
Upvotes: 0
Reputation: 99
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!
Upvotes: 4
Reputation: 2124
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
Upvotes: 5
Reputation: 869
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!
Upvotes: 66
Reputation: 1934
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",
...
},
...
}
Upvotes: 17