Now I can deploy from VSTS to azure, but I can\'t run npm after deploy is successful.
Now it is work like -> run npm install for branch files => zip => copy to azure
You can use PowerShell task or npm task to execute npm commands .
One thing to note: you also need to upload the .npmrc
with auth token to Azure.
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
The Kudu deployment engine that App Service leverages has the ability to run custom deployment scripts. You can include your desired npm command inside of a custom deployment script that will be executed as part of the deployment on Azure's side. No REST API calls required and everything stays in your source control system.
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 install
npm test
Will only run npm install
. There are several workarounds including this:
npm install & npm test
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.