firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.04k stars 951 forks source link

Error parsing triggers: Cannot find module 'firebase-functions' #596

Closed ProgressTM closed 6 years ago

ProgressTM commented 6 years ago

Version info

3.16.0

Steps to reproduce

I installed Node.js and followed everything, now my public folder for the website hosting is on my Desktop and I am trying to deploy it but I getting the following error

=== Deploying to 'inspireme22-955c8'...

i  deploying database, storage, firestore, functions, hosting
i  database: checking rules syntax...
+  database: rules syntax for database inspireme22-955c8 is valid
i  storage: checking storage.rules for compilation errors...
+  storage: rules file storage.rules compiled successfully
i  firestore: checking firestore.rules for compilation errors...
+  firestore: rules file firestore.rules compiled successfully
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  storage: uploading rules storage.rules...
i  firestore: uploading rules firestore.rules...
i  functions: preparing functions directory for uploading...
Error: Error parsing triggers: Cannot find module 'firebase-functions'

Try running "npm install" in your functions directory before deploying.

Expected behavior

It should deploy and host the files in the folder

Actual behavior

[2018-01-12T11:55:29.464Z] ---------------------------------------------------------------------- [2018-01-12T11:55:29.468Z] Command: C:\Program Files\nodejs\node.exe C:\Users\samha\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase --debug [2018-01-12T11:55:29.469Z] CLI Version: 3.16.0 [2018-01-12T11:55:29.469Z] Platform: win32 [2018-01-12T11:55:29.469Z] Node Version: v8.9.4 [2018-01-12T11:55:29.470Z] Time: Fri Jan 12 2018 13:55:29 GMT+0200 (FLE Standard Time) [2018-01-12T11:55:29.470Z] ----------------------------------------------------------------------

laurenzlong commented 6 years ago

@ProgressTM Are you actually using functions? If not, you should remove the functions folder and remove the "functions" key from firebase.json. If you are, then run "npm install" inside your functions folder.

TUKenStone commented 5 years ago

I got the idea from @laurenzlong to remove "functions" key but instead removed "firebase-functions" from package.json and "yarn build && firebase deploy" worked and the error above was gone.

laurenzlong commented 5 years ago

@TUKenStone Yes that would get rid of the error, but your functions may fail in production if you use any aspects of the firebase-functions SDK other than to simply define the function triggers. (e.g. if you have database or Firestore functions, or use functions.config() then you definitely need to keep firebase-functions in package.json. There are other cases too. )

wirrie08 commented 5 years ago

what can be the solution then in such cases , i am exactly in that situation?

vadini-agrawal commented 4 years ago

Running npm install in my functions folder worked fine for me

abircse45 commented 4 years ago

i can not solve this problem..... Error: Error parsing triggers: Cannot find module 'firebase-functions' Require stack:

Try running "npm install" in your functions directory before deploying.

stanstanov commented 4 years ago

i have this problem too

cyiboy commented 3 years ago

any solution to this

yoshirozay commented 3 years ago

$ cd functions $ npm install worked for me

muhammadsqln commented 3 years ago

I am having the same issue. I have tried running npm install within the functions folder, and have tried firebase deploy --only functions inside the functions folder as well as outside.

nolafs commented 3 years ago

Same issue here, tried nearly everything.


Error: Error parsing triggers: Cannot find module firebase-tools/lib/deploy/functions/discovery/jsexports/triggerParser.js

AbhaySingh100 commented 3 years ago

Error: Error parsing triggers: Cannot find module './PaytmChecksum' Require stack:

sebringj commented 3 years ago

What worked for me when using the local emulator and experiencing "module not found" within functions...

This may be overkill... I would also try removing any cache. I tried removing cache and this did not work but I suspect I did not remove the local emulator cache as well.

zachsitka commented 6 months ago

Nothing is working for me with this. I have run yarn install on my functions folder but I still get this error every time I try to run the emulators locally.

This is basically preventing me from using firebase functions at all...

Anyone figure out how to fix this?

versions "firebase-admin": "^12.1.0", "firebase-functions": "^5.0.1"