func command not found while using Azure Functions locally.

Shubham Tomar 1 Reputation point
2022-09-19T13:41:38.17+00:00

I am trying to run Azure Fuctions locally on Windows PC using VS Code. I have already installed Azure Functions Core Tools by following Microsoft Documentation but still facing the same issue. Please, help me to solve this issue.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Subashri Vasudevan 11,226 Reputation points
    2022-09-20T04:44:10.99+00:00

    Hi @Shubham Tomar ,

    After installing it needs a system restart. Request you to restart your system and give it a try.

    Let us know how it goes. Looking forward for your response.

    4 people found this answer helpful.
    0 comments No comments

  2. Samantha NISUS-JOHNSON 25 Reputation points
    2024-07-24T02:33:35.6066667+00:00

    This is for the Exercise - Create a function locally by using the Core Tools.
    These are the command lines (one at a time) I used to get it to work (I am using bash).
    You cannot make any root-level changes because you are not really using your computer.

    1. Create a directory for global npm packages:
      mkdir "${HOME}/.npm-global"
    2. Configure npm to use the new directory:
      npm config set prefix "${HOME}/.npm-global"
    3. Add the new directory to your PATH:
      export PATH="${HOME}/.npm-global/bin:$PATH"
    4. Reload your shell configuration:
      source ~/.bashrc
    5. Now you can install the azure functions core tools globally:
      npm install -g azure-functions-core-tools@4 --unsafe-perm true

    Also be careful when you select the trigger for the function, the exercise says 7 for HTTP trigger but check the Cloud Shell list. For me it was 8, not 7.

    You have to repeat steps 2 to 4 if you get kicked out because of inactivity.

    Hope this helped.

    4 people found this answer helpful.

  3. Limitless Technology 44,746 Reputation points
    2022-09-21T09:30:30.753+00:00

    Hello,

    Please try the next:

    1. Uninstall azure-functions-core-tools from npm: npm uninstall -g azure-functions-core-tools.
    2. Install Azure Functions as Administrator npm install -g azure-functions-core-tools
    3. Add the npm path to the environmental variables

    --------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answer--

    3 people found this answer helpful.
    0 comments No comments

  4. Tomazin, Kenneth G 6 Reputation points
    2024-06-20T10:36:42.2533333+00:00

    In attempting to work through the following exercise of Coursera course for AZ-204:

    Exercise - Create a function locally by using the Core Tools

    A bash shell command prompt is displayed along side the instructions and the first instruction is to run func init, but when I do, I get back func command not found. According to the instructions, the core tools should have already been installed but it appears that they are not. I cannot install them as I would require either sudo or root access to do so. What am I missing? How do I work through this exercise?

    1 person found this answer helpful.

  5. Shubham Tomar 1 Reputation point
    2022-09-20T06:47:53.6+00:00

    After setting the Environment Variable, then reopening the shell worked.
    Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.