Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hi @Rahul, i solved this, setting node engine in package.json
"engines": {
"node": "20.11.0"
},
You can try this, please?
Hugs!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm having trouble configuring an azure-pipelines.yml to deploy to my App Service.
I defined
RuntimeStack: 'NODE|18-lts'
And I ran the node --version script, to log the version of node. However, it gives me 14.18.2. If I put NODE|16-lts, it gives me version 10 in node.
I do not know what else to do. I can't work with node version 18, not even 16.
Here is the full YML:
# Node.js React Web App to Linux on Azure
# Build a Node.js React app and deploy it to Azure as a Linux web app.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: '<<< MY SUBSCRIPTION >>>'
# Web app name
webAppName: '<<< MY APP NAME >>>'
# Environment name
environmentName: '<<< MY APP NAME >>>'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(environmentName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureRmWebAppDeployment@4
displayName: 'Azure App Service Deploy'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
WebAppName: $(webAppName)
packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
RuntimeStack: 'NODE|18-lts'
StartupCommand: 'npm run start'
ScriptType: 'Inline Script'
InlineScript: |
echo "LOG VERSION"
node --version
npm install
npm run build --if-present
npm run start
Please, how solve this?
I don't know what else to do.
Thanks a lot!
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hi @Rahul, i solved this, setting node engine in package.json
"engines": {
"node": "20.11.0"
},
You can try this, please?
Hugs!
@Cícero Martins Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
To test this behavior, we have created a webapp (running on Linux with node 18-lts runtime) through portal from kudu console and by using the cmdlets (node -v, npm -v) we see the node version as 18.14.0 and npm version 6.14.15 as well.
In the above shared .yaml file you have passed the value NODE|18-lts to RuntimeStack in AzureRmWebAppDeployment@4 task.
As per the AzureRmWebAppDeployment@4 definition documentation the value NODE|18-lts need to be passed as runtime stack for function app.
You can get the list of supported runtime versions in webapps for Linux runtime use the below cmdlet.
az webapp list-runtimes --os linux | grep NODE
If you want to pin the webapp to specific NodeJS runtime you can add a CLI task in our pipeline and use the below cmdlet.
az webapp config set --resource-group <resource-group-name> --name <app-name> --linux-fx-version "NODE|18-lts"
For reference, you can refer to the example in this blog post on how to deploy react js app using azure devops.
Feel free to reach back to me if you have any further questions on this.