6

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 ?

Frank van Puffelen
603k85 gold badges895 silver badges868 bronze badges
asked May 13, 2018 at 8:21
5
  • 1
    Did you try as it says to run the npm install inside of your local functions folder? Commented May 13, 2018 at 8:23
  • yes, and nothing happened Commented May 13, 2018 at 8:26
  • and npm i --save firebase-functions inside of the folder also? Commented May 13, 2018 at 8:27
  • 303 sudo firebase serve --only functions,host 304 cd functions 305 npm i --save firebase-functions 306 cd ../ 307 ls 308 sudo firebase serve --only functions,host 309 npm i --save firebase-functions Commented May 13, 2018 at 8:29
  • not working, it still shows 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. Commented May 13, 2018 at 8:29

4 Answers 4

5

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

answered May 13, 2018 at 8:43
Sign up to request clarification or add additional context in comments.

Comments

2

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.

answered Apr 12, 2019 at 1:54

Comments

0

In my case the solution was :

1 - Reinstall Node ( version 10.15.0 ). After download node-v8.11.2-x64.msi from node.org

2 - Reinstall firebase-tools ( npm install firebase-tools -g )

3 - Clear cache ( npm cache clear --force )

answered Jan 23, 2019 at 22:10

Comments

-1

I was having this problem too. I can't explain how, but it turns out that my firebase.json was not correct. Check the functions section of it and make sure it looks like this:

"functions": {
 "source": "functions"
},

Found this SO answer: How to deploy functions from other directory than '/functions'?

answered May 14, 2018 at 5:38

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.