Firebase-tools: functions: Error from emulator. Error parsing triggers: Cannot find module ...

Created on 13 Sep 2018  Â·  5Comments  Â·  Source: firebase/firebase-tools

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

Most helpful comment

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

All 5 comments

I'm having the same problem

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?

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

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

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!

Was this page helpful?
0 / 5 - 0 ratings