English 中文(简体)
Error trying to run a build pipeline in Azure DevOps
原标题:

I have a React.js application which is building via vite. The package.json file is:

{
  "name": "website",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "lodash.debounce": "^4.0.8",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.14.1"
  },
  "devDependencies": {
    "@types/react": "^18.2.14",
    "@types/react-dom": "^18.2.6",
    "@vitejs/plugin-react": "^4.0.1",
    "autoprefixer": "^10.4.14",
    "eslint": "^8.44.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.1",
    "postcss": "^8.4.25",
    "prettier": "^3.0.0",
    "prettier-plugin-tailwindcss": "^0.3.0",
    "tailwindcss": "^3.3.2",
    "vite": "^4.4.0"
  }
}

I am trying to deploy the app to Azure Static Web App. My build pipeline (which I try to run it with a self-hosted agent) is the following:

name: Azure Static Web Apps CI/CD

pool:
  name:  Default 

trigger:
  branches:
    include:
      - main

steps:
- task: NodeTool@0
  inputs:
    versionSpec:  20.4 
  displayName:  Install Node.js 

- script: |
    npm install
    npm run build
  displayName:  Build the React.js app 

- task: CopyFiles@2
  inputs:
    Contents:  $(Agent.BuildDirectory)/s/dist/**  # Pull the build directory (React)
    TargetFolder:  $(Build.ArtifactStagingDirectory) 

- task: PublishPipelineArtifact@1
  inputs:
    targetPath:  $(Pipeline.Workspace) 
    artifact:  static-site 
  displayName:  Publish the build artifacts 

- script: |
    ls  $(Pipeline.Workspace)/s/dist 
  displayName:  Just display the contents of the dist 

- task: AzureStaticWebApp@0
  inputs:
    azure_static_web_apps_api_token: $(DEPLOYMENT_TOKEN)
    app_location:  dist 
    output_location:  dist 
    is_static_export: true
    skip_api_build: true
    skip_app_build: true
    workingDirectory:  $(Pipeline.Workspace)/s/ 
  displayName:  Publish the static site to Azure Static Web Apps 

My big problem is that no matter what I do I am always getting an error in the Publish the static site to Azure Static Web Apps section of the pipeline. The error is:

App Directory Location:  dist  was found.
Looking for event info
Skipping step to build /working_dir/dist with Oryx
Failed to find a default file in the app artifacts folder (dist). Valid default files: index.html,Index.html.
If your application contains purely static content, please verify that the variable  app_location  in your deployment configuration file points to the root of your application.
If your application requires build steps, please validate that a default file exists in the build output directory.


For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting
##[error]Error: The process  /usr/bin/bash  failed with exit code 1
Finishing: Publish the static site to Azure Static Web Apps

Anyone having any idea of what to look for? I have tried all directories and such and no luck... :(

问题回答

暂无回答




相关问题
Team foundation server in the cloud?

We have been using TFS on our own server for a while. We would like to move it in the cloud. Is there any good hosted service? Note: we would like to import all our source and projects

热门标签