为什么Azure构建管道没有为角度构建生成dist文件夹 [英] why is azure build pipeline not generating a dist folder for an angular build

查看:20
本文介绍了为什么Azure构建管道没有为角度构建生成dist文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我运行任何其他任务dist文件夹之前,在生成过程中生成的文件夹似乎已被删除。

 trigger:
    - master
    
    pool: default
    
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'
    
    - script: |
        npm install -g @angular/cli
        npm install
        ng build --prod 
      displayName: 'npm install and build'
    
    #i added this task and it seems like the node_modules and the dist 
    #folder that was generated during the build are not getting copied to the (a)directory 
    #only the source code get copied. it seems like the folders are getting
    #deleted even before the #PublishPipelineArtifact@1 task ran
    
    - task: PublishPipelineArtifact@1
      inputs:
        targetPath: '$(Pipeline.Workspace)/s'
        publishLocation: 'pipeline'

我还尝试在

推荐答案

首先用ng build脚本分隔npm install脚本。其次,我运行的是npm build,而不是ng build。我花了几个小时才注意到。这解决了未创建我的dist文件夹的问题。

- script: |
    npm install
  displayName: 'npm install'

- script: |
    ng build --prod
  displayName: 'ng build'

这篇关于为什么Azure构建管道没有为角度构建生成dist文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆