首页 > 解决方案 > VS 2017 for Mac Azure Function 无法配置 java worker。找不到 JAVA_HOME 应用设置

问题描述

我正在创建一个 Azure Function Apps 项目。运行服务器时出现以下错误。

Hosting environment: Production
Content root path:
/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0

Now listening on: http://localhost:7071 Application started. Press Ctrl+C to shut down. 
[7/9/18 9:48:39 PM] Reading host configuration file '/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0/host.json'
[7/9/18 9:48:39 PM] Host configuration file read:{} 
[7/9/18 9:48:39 PM] Starting Host (HostId=shoufu-1532713004, InstanceId=9869d715-4618-48f0-b0d1-16c4fea66dba, Version=2.0.11651.0, ProcessId=43170, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=) 
[7/9/18 9:48:40 PM] Unable to configure java worker. Could not find JAVA_HOME app setting.
[7/9/18 9:48:40 PM] Could not configure language worker Java. 
[7/9/18 9:48:41 PM] Generating 1 job function(s) 
[7/9/18 9:48:41 PM] Found the following functions: 
[7/9/18 9:48:41 PM] AzureFunctionTest.HttpTrigger.Run
[7/9/18 9:48:41 PM] Host initialized (2120ms) Listening on
http://localhost:7071/ Hit CTRL-C to exit...

Http Functions:

HttpTrigger: http://localhost:7071/api/HttpTrigger

[7/9/18 9:48:43 PM] Host started (3920ms) 
[7/9/18 9:48:43 PM] Job host started 
[7/9/18 9:48:44 PM] Host lock lease acquired by instance ID '000000000000000000000000C475F100'.

有谁知道我该如何解决这个问题?谢谢你。

标签: azureazure-functionsvisual-studio-macazure-functions-core-tools

解决方案


其实这不是错误。这只是一个提示,提醒我们您的系统环境变量中没有JAVA_HOME配置。

它以前用于 java 开发,但在新版本的 Azure Function 核心工具中被证明是不必要的并被删除。看到这个问题

所以你可以忽略这个无害的提示或安装最新版本的功能核心工具来摆脱它。

安装步骤:

  • 为 macOS安装.NET Core 。
  • 安装Homebrew(如果尚未安装)。
  • 使用 bash 安装核心工具包:

    brew tap azure/functions
    brew install azure-functions-core-tools
    

之后导航到内容根路径:

/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0

然后输入func startbash 来调试你的项目。


推荐阅读