如何在Azure Web应用程序中设置节点版本?
我已经使用terraform创建了一个Azure Web应用程序,但其中包含错误版本的NodeJS如何在Azure Web应用程序中设置节点版本?,azure,azure-web-app-service,Azure,Azure Web App Service,我已经使用terraform创建了一个Azure Web应用程序,但其中包含错误版本的NodeJS resource "azurerm_app_service_plan" "app-plan" { name = "${var.prefix}-app-plan" resource_group_name = var.resource_group_name location = var.resource_group_location
resource "azurerm_app_service_plan" "app-plan" {
name = "${var.prefix}-app-plan"
resource_group_name = var.resource_group_name
location = var.resource_group_location
sku {
tier = "Free"
size = "F1"
}
}
#azurerm_app_service doesn't support creating Node.JS 8.10 apps
#https://github.com/terraform-providers/terraform-provider-azurerm/issues/4144
resource "azurerm_app_service" "app-service" {
name = "${var.prefix}-app"
resource_group_name = var.resource_group_name
location = var.resource_group_location
app_service_plan_id = azurerm_app_service_plan.app-plan.id
}
我已尝试更新
以及更新
但是,当我运行控制台时,它仍然显示节点--version v0.10.40
当我运行env
时,看起来PATH
变量不正确
节点8.10确实存在于计算机上的D:\Program Files(x86)\nodejs\8.10.0
如何从RESTAPI更新路径
还有其他选择吗
我的首选项是terraform>AZCL>RESTAPI
注意:
请记住,当我在门户中创建web应用程序时,选择节点8.10会迫使我选择Windows作为O/S。在门户中,它将节点8.10指定为运行时堆栈 az cli将
8.10
指定为运行时:
az webapp list-runtimes|grep "8.10"
"node|8.10",
但是,正如您在问题中看到的,安装的版本是8.10.0
如果我们使用terraform在应用程序设置中设置此选项,则此选项(非直观)将设置正确的节点版本:
resource "azurerm_app_service" "app-service" {
name = "${var.prefix}-app"
resource_group_name = var.resource_group_name
location = var.resource_group_location
app_service_plan_id = azurerm_app_service_plan.app-plan.id
app_settings = {
#The portal and az cli list "8.10" as the supported version.
#"8.10" doesn't work here!
#"8.10.0" is the version installed in D:\Program Files (x86)\nodejs
"WEBSITE_NODE_DEFAULT_VERSION" = "8.10.0"
}
}
在site_config下,linux_fx_版本应设置为“NODE | 8.10” 我已经让它与节点10.14一起工作,使用:
site_config {
linux_fx_version = "NODE|10.14"
}
您还可以在以下位置看到azure web应用程序的不同示例:
读者可以在以下位置浏览代码并对其作出贡献:
resource "azurerm_app_service" "app-service" {
name = "${var.prefix}-app"
resource_group_name = var.resource_group_name
location = var.resource_group_location
app_service_plan_id = azurerm_app_service_plan.app-plan.id
app_settings = {
#The portal and az cli list "8.10" as the supported version.
#"8.10" doesn't work here!
#"8.10.0" is the version installed in D:\Program Files (x86)\nodejs
"WEBSITE_NODE_DEFAULT_VERSION" = "8.10.0"
}
}
site_config {
linux_fx_version = "NODE|10.14"
}