Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error shows 'cannot find module firebase-functions' when deploying a firebase project

When I am trying to deploy a firebase project it shows an error message 'cannot find module firebase-functions' in npm console.The steps(node commands) I have done are:

  1. npm install -g firebase-tools
  2. firebase login
  3. firebase init

and finally where I stucked is
4. firebase deploy

Please help me.

like image 748
Pradeep.T Avatar asked Apr 21 '17 12:04

Pradeep.T


Video Answer


4 Answers

It's simple! If it says can't find module firebase-functions then install them.

npm install firebase-functions
like image 95
Prajwal Waingankar Avatar answered Oct 08 '22 18:10

Prajwal Waingankar


Could be that you didn't follow the instructions provided when running "firebase init". You should press space and then enter in order to select the option you want - possibly that's why there was no functions folder.

like image 27
Marianna Panteli Avatar answered Oct 08 '22 18:10

Marianna Panteli


you should install node_modules in the functions directory in your project

cd functions
npm install 

then run firebase deploy

like image 7
Amina Darwish Avatar answered Oct 08 '22 18:10

Amina Darwish


This may happen if you have requires with wrong cases!

The firebase function file system seems to be case sensitive.

So if you do

const { myStuff } = require('./mystuff');

but the file is actually named myStuff.js, it may very well work locally, but fails on build

like image 1
Jkarttunen Avatar answered Oct 08 '22 17:10

Jkarttunen