24

Keep getting the error

'func' is not recognized as an internal or external command, operable program or batch file.

Image of error

when entering func into the cmd command line, when following this tutorial
I have installed python (3.7.3) and all the correct extensions, so am confused as to why this issues is occuring.

Any help with this would be much appreciated.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
grand2019
  • 562
  • 2
  • 6
  • 16
  • At a glance, it seems you have skipped this important line: `import azure.functions as func` – Błotosmętek Jun 10 '19 at 12:29
  • @Błotosmętek I get the same error for import **The term 'import' is not recognized as the name of a cmdlet, function, script file, or operable program.** – grand2019 Jun 10 '19 at 13:12
  • 1
    It seems you do not install the extension [Azure Functions Core Tools](https://code.visualstudio.com/docs/python/tutorial-azure-functions#_azure-functions-core-tools). – Charles Xu Jun 11 '19 at 01:02
  • `import` is Python keyword, it should be recognized no matter what. Are you sure you selected Python as your language? See https://code.visualstudio.com/docs/python/tutorial-azure-functions#_create-the-function step 2, second point. – Błotosmętek Jun 11 '19 at 12:15
  • Or you could use [npm](https://github.com/Azure/azure-functions-core-tools#windows) to install it. npm install -g azure-functions-core-tools – George Chen Jun 12 '19 at 01:48
  • 1
    the error in question is related to function cli. you can download for windows from the following link https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Ccsharp%2Cbash#v2 You certainly need NPM for above func cli. – A Modgil Oct 20 '20 at 23:25
  • Run the following command `npm install -g azure-functions-core-tools` as seen in the documentation: https://learn.microsoft.com/en-us/azure/developer/python/tutorial-vs-code-serverless-python-01#azure-functions-core-tools – John Dec 07 '20 at 19:45

2 Answers2

22

I had this issue and the provided answer didn't solve my problem.

Steps I took to fix (Windows):

  1. Install Chocolately
  2. Run choco install azure-functions-core-tools
  3. Finally run func: %%%%%% %%%%%% @ %%%%%% @ @@ %%%%%% @@ @@@ %%%%%%%%%%% @@@ @@ %%%%%%%%%% @@ @@ %%%% @@ @@ %%% @@ @@ %% @@ %% %

EDIT

While the above did solve my problem, the underlying issue was that func was not on my path, so it was not being recognised as a command.

Luke Garrigan
  • 4,571
  • 1
  • 21
  • 29
  • 3
    Yo da real MVP. Cheers – plumbus_bouquet Nov 12 '19 at 14:20
  • 3
    If you are using VSCode, don't install the core tools using Choco. It always installs x86. VSCode is x64. Installing core tools using Choco breaks VSCode debugging. – Troy Witthoeft Dec 08 '19 at 13:56
  • 3
    Do `choco install azure-functions-core-tools-3` to install version 3. Otherwise, it will default to version 2. – Konstantin Jul 27 '20 at 11:58
  • Please note that, as for now, the latest Chocolatey version of the `azure-functions-core-tools` is v3 while v4 is in the town. It can be downloaded from here: [link](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash#install-the-azure-functions-core-tools) – Dariusz Woźniak Mar 30 '22 at 11:50
  • Didn't see anyone mentioning Winget so just thought I could. I basically used: - winget install 'Azure Functions Core Tools' - Restarted my terminal/vscode, and it worked. Already had NPM installed. – Emmanuel Motsi Oct 05 '22 at 12:35
  • On a macOS, the solution is long(ish): `/usr/local/share/dotnet/dotnet "$HOME/Library/Application Support/VisualStudio/azure-functions-cli/Releases/4.40.0/cli_x64/func.dll"` – Jari Turkia Jun 04 '23 at 16:11
13

As part of prerequisites for Azure Function Core Tools , please make sure npm is installed.

Was able to install on Windows using below links

Downloading and Installing Node.js and npm

NVM for Windows

Once NPM is installed, you can install azure functions using below commands

enter image description here

Post installation was able to run "func" command successfully.

Additional Documentation Reference

Azure Functions for Vistal Studio Code

Hope the above information helps.

bharathn-msft
  • 877
  • 5
  • 10