无法在 VS Code 中调试 azure 函数,错误 运行ning func host start,但可以从 powershell 手动 运行 "func host start"
Cannot debug azure functions in VS Code, error running func host start, but can manually run "func host start" from powershell
我在 VS Code 中调试 azure 函数项目时遇到困难。
我使用 func init 创建了一个 azure 项目。
当我从 运行 菜单中单击“调试”时,项目会构建,但在尝试 运行“func host start”时出现以下错误:
> Executing task: func host start <
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or opera
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -Command func host start
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Command:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如果我 运行 func 主机从 powershell 手动启动它工作正常。
到目前为止我已经尝试过:
- 正在更新功能核心工具。
- 正在更新 .net
- 卸载并重新安装 vs 代码
- 确保核心工具的路径在路径环境变量中
- 运行宁 vs 代码作为管理员
如果您能帮我解决这个问题,我们将不胜感激。
更新,添加错误截图:
我们需要确保以下两个在我们的 VS Code 中可用:
- Azure 工具扩展
- Azure 函数代码工具。
添加后我们可以正常执行代码,检查是否有错误,稍后设置断点,按F5启动进入调试,现在我们需要运行终端中的函数,就我而言,我将解释器用作 Python,我 运行 如下所示:
我们可以试试这个方法,而不是 运行从电源 shell 终端连接它。
现在您收到的错误与丢失的包有关。还要确保在执行之前先从 PS 连接到您的 Azure AD。
大量谷歌搜索发现了更改 vs 代码中的默认终端的建议。
它被设置为 powershell,但将其更改为命令提示符解决了问题。
通过键入“终端:Select 默认配置文件,可以在命令面板中找到设置。
这将显示可用终端列表、命令提示符、gitbash、windows powershell、.net powershell。
选择命令提示符允许调试。
感谢大家的帮助!
我在 VS Code 中调试 azure 函数项目时遇到困难。 我使用 func init 创建了一个 azure 项目。 当我从 运行 菜单中单击“调试”时,项目会构建,但在尝试 运行“func host start”时出现以下错误:
> Executing task: func host start <
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or opera
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -Command func host start
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Command:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如果我 运行 func 主机从 powershell 手动启动它工作正常。
到目前为止我已经尝试过:
- 正在更新功能核心工具。
- 正在更新 .net
- 卸载并重新安装 vs 代码
- 确保核心工具的路径在路径环境变量中
- 运行宁 vs 代码作为管理员
如果您能帮我解决这个问题,我们将不胜感激。
更新,添加错误截图:
我们需要确保以下两个在我们的 VS Code 中可用:
- Azure 工具扩展
- Azure 函数代码工具。
添加后我们可以正常执行代码,检查是否有错误,稍后设置断点,按F5启动进入调试,现在我们需要运行终端中的函数,就我而言,我将解释器用作 Python,我 运行 如下所示:
我们可以试试这个方法,而不是 运行从电源 shell 终端连接它。
现在您收到的错误与丢失的包有关。还要确保在执行之前先从 PS 连接到您的 Azure AD。
大量谷歌搜索发现了更改 vs 代码中的默认终端的建议。 它被设置为 powershell,但将其更改为命令提示符解决了问题。
通过键入“终端:Select 默认配置文件,可以在命令面板中找到设置。 这将显示可用终端列表、命令提示符、gitbash、windows powershell、.net powershell。
选择命令提示符允许调试。
感谢大家的帮助!