How to run npm command on azure app service after deployment success by VSTS?
The Azure App Service Deployment task in VSTS now supports a post-deployment script. Here is a screen-shot from version 3.* of the task:
See Task Parameters for more details.
Windows App Services users: Watch out for an npm bug that prevents multiple npm
commands from being run (inline or in a script). For example:
npm installnpm test
Will only run npm install
. There are several workarounds including this:
npm install & npm test
There is no out of box build task to achieve the feature you want. If you do want to run the npm from Azure App Service:
Manually: You can go to Kudu console of the App Service and run npm command there:
Automatically: You need to create your own build task to run the npm command via Kudu Rest API
You can run commands like npm install
via the Kudu REST API.
Here's a scripted example written in PowerShell.
Add a PowerShell script task after the Azure App Service Deploy task to invoke npm install
(or any other command that Kudu supports). And disable the npm install task in your build pipeline.