When i try to build angular app using azure devops and deploy to azure static web app i’m receiving below error
The app build failed to produce artifact folder: ‘dist/harmony-front’. Please
ensure this property is configured correctly in your deployment
configuration file.
I tried by changing output_location to / , dist, /dist , dist/harmony-front,
nothing seems to work
here’s the yaml code for the deployment section
- task: AzureStaticWebApp@0
inputs:
app_location: "/"
api_location: "api"
output_location: "./dist/harmony-front"
app_build_command: 'npm run build:prod'
skip_api_build: true
verbose: true
env:
continueOnError: true
CUSTOM_BUILD_COMMAND: "npm install --force"
azure_static_web_apps_api_token: $(deployment_token)
What was the mistake i made
Thanks
2
Answers
Actually I found the issue and will post for future reference. if someone had the same issue.
issue start when you override build command using
CUSTOM_BUILD_COMMAND
will overwrite theRUN_BUILD_COMMAND
so based on the comment of the issue posted on Github instead ofnpm install --force
command combined with build likenpm install --force && npm run build
works like charmI have tried to repro the same and got positive results after following the below steps.
Step 1: Create a simple angular project and build the project on a local machine and inspect the dist folder.
Step 2: Push the code to Azure Repos.
Step 3: Create azure pipeline as shown below.
Step 4: Verify the result.
If you are still facing that issue, verify the AzureStaticWebApp@0
output location path in angular.json file as below. Both paths must be exact.