i functions: Preparing to emulate functions. Warning: You're using Node.js v8.10.0 but Google Cloud Functions only supports v6.11.5.
⚠ 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 '/home/developer/Development/host2/functions'
Try running "npm install" in your functions directory before deploying.
We are new in firebase function , How to solve this issue ?
In many cases, new features and bug fixes are available only with the latest version of the Firebase CLI and the firebase-functions SDK. It's a good practice to frequently update both the Firebase CLI and the SDK with these commands inside the functions folder of your Firebase project:
npm install -g firebase-tools
npm install firebase-functions@latest firebase-admin@latest --save
visit: https://firebase.google.com/docs/functions/get-started
I don't know if my problem was the same as your, but for further reference I will post my solution.
In my case, I was using TypeScript
instead of JavaScript
, so the code needed to be compiled before run firebase serve
.
In your Firebase app directory:
$ cd functions/
$ npm run-script build
$ cd ..
$ firebase serve
The last command maybe need super user permission, so sudo firebase serve
.
Optionally you can run npm run-script lint
before npm run-script build
to check for possible errors if you are using tslint
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With