如何确定我在本地使用的 Azure Function 运行时版本?

Ori*_*ian 3 azure azure-functions azure-functions-runtime azure-functions-core-tools

我已经下载了 azure-functions-core-tool@3 ,当我使用 Azure Tools 运行新创建的函数项目时,它似乎正在运行 v2,尽管我不确定。

settings.json文件如下:

{
  "azureFunctions.deploySubpath": ".",
  "azureFunctions.postDeployTask": "npm install",
  "azureFunctions.projectLanguage": "JavaScript",
  "azureFunctions.projectRuntime": "~3",
  "debug.internalConsoleOptions": "neverOpen",
  "azureFunctions.preDeployTask": "npm prune"
}
Run Code Online (Sandbox Code Playgroud)

但是,当我使用“npm start”或“func start”运行Azure函数时,标头部分报告:

Azure Functions Core Tools (2.7.2184 Commit hash: 5afacc827c2848e4debc23bb96604f1ffce09cc7)
Function Runtime Version: 2.0.12961.0
Run Code Online (Sandbox Code Playgroud)

后来在日志中我看到:

[warn] The Node.js version you are using (v12.17.0) is not fully supported by Azure Functions V2. We recommend using one the following major versions: 8, 10.
Run Code Online (Sandbox Code Playgroud)

这似乎意味着这些功能仍在 2.0 模式下运行。

如何确定正在执行哪个版本的运行时?

ric*_*sch 5

如果你看到

函数运行时版本:2.0.12961.0

您正在运行运行时 V2。

运行npm install -g azure-functions-core-tools@3显式安装 V3 运行时,您将在本地运行 V3。

Azure 函数运行时 V3

版本 2.x 和 3.x
版本 2.x/3.x 工具使用基于 .NET Core 构建的 Azure Functions 运行时。.NET Core 支持的所有平台都支持此版本,包括 Windows、macOS 和 Linux。

详细信息:使用 Azure Functions 核心工具

  • 显然我有一份用 Chocolatey 安装的 v2 副本,它覆盖了用 npm 安装的版本。 (4认同)