gpt4 book ai didi

node.js - Azure Web 应用程序意外 "Bad Request"

转载 作者:行者123 更新时间:2023-12-03 05:53:32 28 4
gpt4 key购买 nike

我偶尔会在 Azure 控制台(位于 Azure Web 应用程序的主“ Blade ”中)中收到“错误请求”。一个例子是运行 npm install grunt-sass 时,但还有其他几次使用不同的命令,所有这些都是有效命令,应该立即执行,不会出现错误。

enter image description here

enter image description here

我认为这是 Azure 中的一个错误。我在使用 Kudu 诊断控制台时没有看到这个问题。

为什么会发生这种情况?

最佳答案

就我而言,它看起来取决于 Azure Web Apps sanbox 中的 npm 版本。我将 npm 版本升级到 4.2.0,并通过 Kudu Conosole 或应用服务编辑器的控制台工具成功安装 grunt-sass

请导航至 Azure Web Apps 的应用程序设置边栏选项卡,然后在应用设置部分添加WEBSITE_NPM_DEFAULT_VERSION 配置:
enter image description here

然后,它应该按预期工作。

在 Kudu 控制台中:
enter image description here

在应用服务编辑器中:enter image description here

最后,我们建议您可以利用Azure Web Apps的自定义部署,您可以在package.json中配置依赖项,并通过Git部署到Azure,部署任务将自动安装依赖项,可以引用Custom startup command for Node.js app on Azure with Babel 6类似的步骤。

关于node.js - Azure Web 应用程序意外 "Bad Request",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44711117/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com