0

I am following the Node.js tutorial at https://codelabs.developers.google.com/codelabs/local-development-with-cloud-functions#3.

My code file is index.js and main in package.json is "index.js".

When I execute node node_modules/@google-cloud/functions-framework --target=validateTemperature as per the instructions, nothing happens. It simply returns immediately, with no terminal output or any error messages.

I tried putting some syntactically wrong stuff in index.js, but still no error was triggered.

I am at a loss of how to troubleshoot or proceed. Looking for some tips.

1 Answer 1

2

Tried following the steps in the codelabs that you shared and it works fine for me.

instead of running node node_modules/@google-cloud/functions-framework --target=validateTemperature try running npx @google-cloud/functions-framework --target=validateTemperature

Sample Output:

$ npx @google-cloud/functions-framework --target=validateTemperature Serving function... Function: validateTemperature Signature type: http URL: http://localhost:8080/ 

You can also check this github

Sign up to request clarification or add additional context in comments.

3 Comments

Yes, using npx works, but I wonder why it won't run with simply node.
seems to be documentation error see in this release notes also mentioned npx command or else /node_modules is missing some packages use of npx is it will install and run it without having that package globally installed.
I got to work with npm start, where start in package.json is functions-framework target=validateTemperature.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.