firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

functions: Error from emulator. Error parsing triggers: Cannot find module ...

Open npomfret opened this issue 8 years ago • 5 comments

I'm trying to use an npm package in my function but when I try to deploy I just get

functions: Error from emulator. Error parsing triggers: Cannot find module

I have the package in the in my package.json file:

...
"dependencies": {
    "ccxt": "^1.17.283", 
    "firebase-admin": "^6.0.0",
    "firebase-functions": "^2.0.5"

I've run npm install and I can see the ccxt directory in my node_modules. I've tried cleaning and reinstalling, but still get the same error.

Here's the full output:

firebase serve --only functions

=== Serving from ...

i  functions: Preparing to emulate functions.
⚠  functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
⚠  functions: Error from emulator. Error parsing triggers: Cannot find module 'cctx'

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

... and

$ node --version
v6.11.5
$ npm --version
6.4.1
$ firebase --version
4.2.1

npomfret avatar Sep 13 '18 11:09 npomfret

I'm having the same problem

rscheurman avatar Sep 27 '18 05:09 rscheurman

I have the same problem. Fresh basic projects with nothing special in the setup. @npomfret , you closed it after you opened it. How did you solve it?

gerhardcit avatar Oct 21 '18 12:10 gerhardcit

I had the same problem. @npomfret, could you tell us how you solved this problem? In my case, I started my functions project as a typescript project, so I needed to build it before serve.

cd .\functions
npm run build
cd ..
firebase serve

iarly avatar Jan 16 '19 16:01 iarly

I'm trying to use an npm package in my function but when I try to deploy I just get

functions: Error from emulator. Error parsing triggers: Cannot find module

I have the package in the in my package.json file:

...
"dependencies": {
    "ccxt": "^1.17.283", 
    "firebase-admin": "^6.0.0",
    "firebase-functions": "^2.0.5"

I've run npm install and I can see the ccxt directory in my node_modules. I've tried cleaning and reinstalling, but still get the same error.

Here's the full output:

firebase serve --only functions

=== Serving from ...

i  functions: Preparing to emulate functions.
⚠  functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
⚠  functions: Error from emulator. Error parsing triggers: Cannot find module 'cctx'

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

... and

$ node --version
v6.11.5
$ npm --version
6.4.1
$ firebase --version
4.2.1

solution:

I think u are changing name while importing them

Your error is functions: Error from emulator. Error parsing triggers: Cannot find module 'cctx'

but in your dependencies file u have library name 'ccxt' not 'cctx'

i this this will help u

purushottamyadavbattula avatar Feb 13 '19 09:02 purushottamyadavbattula

I had the same problem. @npomfret, could you tell us how you solved this problem? In my case, I started my functions project as a typescript project, so I needed to build it before serve.

cd .\functions
npm run build
cd ..
firebase serve

Thanks, this worked for me!

rodrigoxavier avatar Aug 12 '19 17:08 rodrigoxavier